Fun with markov chains in JavaScript!