Markov chains can be used to recompose a list of elements respecting the fact that the probability of a certain element depends on preceding elements in the list.
|:: (Ord a, RandomGen g)|
size of prediction context
training sequence, the one to walk through randomly
index to start the random walk within the training sequence
random generator state
Creates a chain of elements respecting to the probabilities of possible successors. The list is considered being cyclic in order to have successors for the last elements.
take 100 $ run 2 "The sad cat sat on the mat. " 0 (Random.mkStdGen 123)