Markov chains in inefficient JS.