Taking a leaf out of Mr Burns’ room of squawking monkeys mashing their mitts against typewriters, hoping to produce a single stanza of Shakespeare (embedded below), a certain Mr Andersen has actually produced a Shakespearean poem — A Lover’s Complaint — using random-typing monkeys. Well, kind of. It was the best of times, it was the blurst of times…
You see, the probability of a single monkey sitting down and typing a complete play — or even a poem or sentence — is infinitesimally small. Like, so small that it’s not even worth considering. The “infinite monkey theorem” (yes, it really exists) stipulates that a monkey would almost surely type any given text, given an infinite amount of time — but that just means that it’s theoretically possible, while still being incredibly improbable.
To get around this rather annoying barrier, Jesse Andersen cheated. Instead of requiring a single monkey to type out the entire works of Shakespeare, he instead got an army of virtual, cloud-based, Amazon EC2-powered monkeys to type out random strings of nine letters. If these strings partly or fully matched any Shakespearean utterance, it was considered “found.” The process was controlled by a Hadoop installation on Andersen’s Ubuntu computer, and Sean Luke’s Mersenne Twister ensured that the strings produced by the monkeys were as random as it gets.
In other words, while Shakespeare’s 43 works consist of 884,429 words, totalling tens of millions of characters, Andersen’s monkeys only had to find enough nine-letter strings to capture some 28,829 unique words. Finding nine-letter words isn’t very hard — there are only 5.5 trillion possible combinations, and indeed it only took Andersen’s monkeys a few weeks to find 99.9% of Shakespeare’s life works.
The few million monkeys (Andersen doesn’t give an exact amount) are now trying to find the last few characters in the 42 remaining plays and poems. A Lover’s Complaint is by far the shortest work of Shakespeare, too — 11,000 characters, compared to 70,000 in the next-shortest (A Comedy Of Errors) — so we might be waiting a little while for Andersen’s arduous Amazonian monkeys to finish their work.
Still, as Andersen points out, this project is just a bit of experimental fun, and a way to pay homage to one of his favorite episodes of The Simpsons… so perhaps we shouldn’t take his cheating too seriously.
View full post on Extremetech