Level 1 is based on the statistical distribution of single characters. Level 2 is based on the statistical distribution of character pairs. Level n is based on the statistical distribution of groups of n characters. (The algorithm is a letter-based Markov text generator. Level n gibberish is a Markov chain of order n-1.)
Hints: This works best if the input is a paragraph of ordinary words with no line breaks, no tabs, and no extra spaces. Single punctuation marks (periods, commas, etc.) work well, but paired punctuation marks (quotes, parentheses, etc.) do not work well.