# scan through the text and build a suffix list for all prefixes
set w1 and w2 to the first two words in the text
for each word w3 in the rest of the text
add w3 as a new suffix for w1w2
replace w1 by w2 and w2 by w3
repeat
# use the prefixes+suffixes to generate "similar" random text
set w1 and w2 to the first two words in the text
print w1 and w2
loop
randomly choose w3, one of the suffixes for w1w2
print w3
replace w1 by w2 and w2 by w3
repeat
|