People from the other thread discussing Markov chains look much more adept than me at producing algorithms, so I thought I’d try asking for this because I think it’s beyond me.

I can create Markov chains by hand, then tweak them for what sounds best to me with Sonic Pi’s randomization features. It would be much more practical to be able to call up such matrices via an index rather than limit myself to trying the small collection I can tweak by hand. This can be done if I restrict all elements of an n x n Markov matrix to a 1-decimal place number.

For example, if n = 5, then we could concatenate in row order each single digit to the right of each decimal point to produce an integer of 25 places that uniquely represents that matrix. The 5x5 Markov matrices compose a small fraction of those (10 ** 25) 5x5 matrices, but I can’t think of a way to index them separately. In other words, the subset of 5 x 5 matrices with 1-decimal place elements, and whose row elements add up to 1.0 can be indexed, and then I could try out melodies in my Markov Player simply by passing an index without having to construct any matrix by hand. Can anyone index this limited type of Markov matrix?