character markov generator, with arbitrary memory