A Markov process is a stochastic process for which everything that we know about its future is summarized by its current value. Both the random walk and the autoregressive process are example of Markov processes. A martingale is a stochastic process. The random walk with zero drift and the autoregressive process with a=1 are special cases of martingales.
The depth parameter controls how many previous characters each character depends upon. For example, if depth = 0 then each character is chosen independently of all the rest. If depth = 4, then each character is chosen according to the conditional distribution given the most recent 4 characters.
If depth = 0, the work of a blindfolded monkey at a typewriter is simulated. The greater the depth parameter, the more the generated text appears legible.
This program will generate 3000 random characters. The program is quite large and takes 10-30 seconds to run, so be patient.
from Terry McConnell, Math Department, Syracuse University