Check out this article on Markov Chains