Markov chain on letter scale and random text
If each character only depends on the previous character, you could just compute the probabilities for all 27^2 pairs of characters.
I would like to generate a random text using letter frequencies from a book in a .txt file, so that each new character (string.lowercase + ' ') depends on the previous one.
How do I use Markov chains to do so? Or is it simpler to use 27 arrays with conditional frequencies for each letter?