If you put 100 monkeys with typewriters in a room long enough, eventually you’ll get Hamlet.

This is an expression I’ve heard many times. It means anything can come out of random; that always fascinated me.


A monkey on a typewriter would produce random letters. 6 random letters could be dhsllr or hamlet or klefim. Sometimes randomness produces sequences that seem not random. But the fact that snake has meaning but uvzmp has not is pretty much arbitrary. Some sequence of letters have meaning, some don’t.

Out of a random sequence of letters, it all boils down to probabilities. Out of a set of 26 letters, a sequence of 5 of them have about 1 / 12 billion (26^5) chance of being exactly the word snake. The probability of getting a certain word or sentence goes down as you add more letters.

So how about a full book ? The version of Hamlet I’m using has about 170k characters. Out of a reduced alphabet of 26 letters + 1 space (leaving out all the ponctuation), the amount of possible combinations for a set of 170000 characters is ridiculous (it’s a 240k+ digits figure).

Very unlikely, but theoretically possible.

Now let’s say the random character generator is Twitter. For each word in Hamlet, we wait until somebody tweets it. Then we do the same with the next word, et cætera until the end of the book!

This is exactly what you can see on twitter-writes-hamlet.com: a bot listening to a real-time Twitter feed, waiting for someone to tweet the next word.

The result of this experiment will be the very first version of Hamlet written by thousands of people without knowing it.

The project is on GitHub: https://github.com/lipsumar/twitter-writes-hamlet