Monkeys do Shakespeare

consider the 13-letter sequence “TOBEORNOTTOBE.” Those hypothetical million monkeys, each pecking out one phrase a second, could take as long as 78,800 years to find it among the 2613 sequences of that length. But in the 1980s Richard Hardison of Glendale College wrote a computer program that generated phrases randomly while preserving the positions of individual letters that happened to be correctly placed (in effect, selecting for phrases more like Hamlet’s). On average, the program re-created the phrase in just 336 iterations, less than 90 seconds. Even more amazing, it could reconstruct Shakespeare’s entire play in just four and a half days.