# Millions of Monkeys - a Q of chance

**URL:** <https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129>\
**Category:** Factual Questions\
**Created:** [June 7, 2004, 5:34pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129 "2004-06-07T17:34:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![E\_Pluribus\_Mumps](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@E\_Pluribus\_Mumps](https://boards.straightdope.com/u/E_Pluribus_Mumps)\
**Post date:** [June 7, 2004, 5:34pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/1 "2004-06-07T17:34:41Z")

</div>

There is the old statement on chance that: a million monkeys on typewriters would eventually type the works of Shakespeare. Its meaning is clearly that all things have a chance of happening, and given the fullness of time, eventually will, no matter how unlikely these seem.

But a friend insists that – practical matters of the qwerty keyboard aside – no “random selection” of letters would ever result in the works of Shakespeare. He says this would somehow violate the whole concept of randomness. A single word? I ask. Sure. A heroic couplet? Yep. How about a sonnet? He has no problem. But he says the complete works is just too big to be generated randomly regardless of how many trials are taken. He’s wrong at least, and possibly insane, right?

---

<div class="post-metadata">

**Author:** ![Giles](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/giles/32/60_2.png) [@Giles](https://boards.straightdope.com/u/Giles)\
**Post date:** [June 7, 2004, 5:53pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/2 "2004-06-07T17:53:46Z")

</div>

Let’s assume 40 keys (there are more, anbd the shift key is relevant too, but let’s keep it simple.

Let’s assume 10,000 characters in a play (there are more, but again let’s keep it simple.

That means 40 ^ 10,000 different possibilities for monkeys doing it randomly.

I don’t think the universe is going to last long enough for you to see that Shakespearean play.

---

<div class="post-metadata">

**Author:** ![Shalmanese](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Shalmanese](https://boards.straightdope.com/u/Shalmanese)\
**Post date:** [June 7, 2004, 5:58pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/3 "2004-06-07T17:58:24Z")

</div>

Whyever not?

The calculation is relatively simple.

Assuming we restrict it to only letters and spaces and the distribution is totally random, the chance of producing _any_ n letter string is 27^n. Since Shakespere is a string with n letters, it has an equal chance as any other string.

for example: “to be or not to be” would have a 1 in 27^18 or 58149737003040059690390169 chance.

---

<div class="post-metadata">

**Author:** ![RealityChuck](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/realitychuck/32/195_2.png) [@RealityChuck](https://boards.straightdope.com/u/RealityChuck)\
**Post date:** [June 7, 2004, 6:06pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/4 "2004-06-07T18:06:56Z")

</div>

I believe the original concept was an infinite number of monkeys typing an infinite amount of time. Since the time it would take to do this randomly is not infinite – just very big – it’s possible.

It’s also a little better odds if you allow the example of all of Hamlet except for a single typo in a single word. This yields many more examples. Same for examples that are all of Hamlet except for a single word (“To be or not to xt”). Indeed, you will need to determine how many errors there can be and have it still be considered “Hamlet.”

It may seem odd that the “Hamlet” may appear spontaneously in something like this, but it’s just as probable as any combination of letters.

---

<div class="post-metadata">

**Author:** ![silenus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/silenus/32/166_2.png) [@silenus](https://boards.straightdope.com/u/silenus)\
**Post date:** [June 7, 2004, 6:07pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/5 "2004-06-07T18:07:47Z")

</div>

A million monkeys at a million keyboards…we call it “The Internet.” 😃

---

<div class="post-metadata">

**Author:** ![Squink](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@Squink](https://boards.straightdope.com/u/Squink)\
**Post date:** [June 7, 2004, 6:10pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/6 "2004-06-07T18:10:46Z")

</div>

Ask your friend how his random number generator would know to avoid the string representing the complete works of Shakespeare. Would it also avoid the string holding the complete works of Shakespeare, except for a single misspelt word on page 507? What about versions of Shakespeare with an arbitrary number of errors? What about all the other authors whose work a million typing monkeys might replicate?  
Where in the world would your monkeys store the massive amount of information they’d need to avoid typing such “nonrandom” strings? Their brains aren’t all that big.

You may find this thread interesting: [Does randomness truly exist?](http://boards.straightdope.com/sdmb/showthread.php?t=161902&highlight=random)

---

<div class="post-metadata">

**Author:** ![Garfield226](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@Garfield226](https://boards.straightdope.com/u/Garfield226)\
**Post date:** [June 7, 2004, 6:20pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/7 "2004-06-07T18:20:43Z")

</div>

A) Yes your friend is wrong.

B) You may be interested in this java simulator, the [Monkey Shakespeare Simulator](http://user.tninet.se/~ecf599g/aardasnails/java/Monkey/webpages/). The simulation started last July with 100 monkeys, and they have been increasing exponentially ever since (there are now 1.49^22 monkeys in the simulator, and the record is currently 16 consecutive letters. Note, however, that this simulation includes letter case, punctuation, and spacing.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [June 7, 2004, 6:30pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/8 "2004-06-07T18:30:52Z")

</div>

This may hinge on your friend’s definition of “randomness.” He may be thinking of “random” = “without order,” in which case the works of Shakespeare would, by definition, not be random.

But they would, assuming the typewriter keys were pressed at random (which I doubt very much you could get actual monkeys to do—yet another reason why this is all hypothetical), be equally likely to appear as any other document of the same length—like, say, the complete works of Shakespeare in reverse, or the complete works of Shakespeare but with one wrong letter, or the works of Shakespeare in which every instance of the name “Hamlet” had been replaced with “Piglet”—or any _particular_ random-looking stream of letters and punctuation.

---

<div class="post-metadata">

**Author:** ![CalMeacham](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/calmeacham/32/35_2.png) [@CalMeacham](https://boards.straightdope.com/u/CalMeacham)\
**Post date:** [June 7, 2004, 7:26pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/9 "2004-06-07T19:26:38Z")

</div>

There’s a professor who was doing this over twenty years ago – I have an article of his from **American Scientist** from the early 1980s entitled “How Artificial is Intelligence?” (Don’t recall his bname, though). He compiled lists of probabilities of letters from various sources, then used a random number generator to act as a “monkey” cranking out random letters at the probability they were actually used. That’s a bit different from the classic case, where all letters get equal probability. The results were still highly random looking.

Things got more interesting when he started plotting and using probabilities of _pairs_ of letters. (“the”, for instance, shows up a _lot_ because it’s in “the”, not to mention common words like “there” and “other”, and because “t” and “e” are, individually, very common. For his purposes, btw, “space” counts as a letter). Now things resembling words showed up with increasing frequency. He called these the results of “second order monkeys”. The results of “third order monkeys” (using probabilities of thre–letter-sets) resulted in even more realistic looking words.

Fourth Order monkeys were very interesting – a lot of obscenities started showing up.

By the time he got to fourth order or above, “monkeys” typing in foreign languages started looking indistinguishable from the real thing. In English, recognizable sentence fragments started to show up – and they weren’t simply reproducing the host text nmined for the probasbilities.

Even the guy who did this, though, said that the computer-based “random number generators” probably didn’t have enough randomnness to restore big portions of the original text.

---

<div class="post-metadata">

**Author:** ![Mangetout](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mangetout/32/19_2.png) [@Mangetout](https://boards.straightdope.com/u/Mangetout)\
**Post date:** [June 7, 2004, 10:33pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/10 "2004-06-07T22:33:02Z")

</div>

> [@E Pluribus Mumps](#):
>
> There is the old statement on chance that: a million monkeys on typewriters would eventually type the works of Shakespeare. Its meaning is clearly that all things have a chance of happening, and given the fullness of time, eventually will, no matter how unlikely these seem.

[silly nitpick] given the fullness of time, all those things **that are logically possible** have a chance of occurring; things that simply aren’t possible due to logical impossibility (such as the colour red being the same thing as the colour green) will remain impossible, no matter how long you wait.

---

<div class="post-metadata">

**Author:** ![alimarx](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@alimarx](https://boards.straightdope.com/u/alimarx)\
**Post date:** [June 7, 2004, 10:38pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/11 "2004-06-07T22:38:32Z")

</div>

> [@CalMeacham](#):
>
> – and they weren’t simply reproducing the host text nmined for the probasbilities…

OK, who’s _really_ typing this? 😉

---

<div class="post-metadata">

**Author:** ![Rufus\_Xavier](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@Rufus\_Xavier](https://boards.straightdope.com/u/Rufus_Xavier)\
**Post date:** [June 7, 2004, 11:00pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/12 "2004-06-07T23:00:10Z")

</div>

> [@E Pluribus Mumps](#):
>
> But a friend insists that – practical matters of the qwerty keyboard aside – no “random selection” of letters would ever result in the works of Shakespeare.

Just remind him that his own very existence is even more improbable than that.

---

<div class="post-metadata">

**Author:** ![Kamino\_Neko](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/kamino_neko/32/34_2.png) [@Kamino\_Neko](https://boards.straightdope.com/u/Kamino_Neko)\
**Post date:** [June 7, 2004, 11:38pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/13 "2004-06-07T23:38:43Z")

</div>

> [@E Pluribus Mumps](#):
>
> But a friend insists that – practical matters of the qwerty keyboard aside – no “random selection” of letters would ever result in the works of Shakespeare. He says this would somehow violate the whole concept of randomness.

Ask him in what way does having one given string of, let’s say, 1,000,000 characters that happens to match a given non-random set of 1,000,000, rather than, say, the alphabet repeated 38461.5 times (though not neccessarily in order - just that all 26 letters show up 38461 times, and 13 of them show up a 38462nd time) violate the concept of randomness.

As has already been said, the fact that the complete works of Shakespeare CAN come up - it has the exact same (astronomical) chance as any other string of equal length - is rather an important part of the concept of randomness.

---

<div class="post-metadata">

**Author:** ![Exapno\_Mapcase](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/exapno_mapcase/32/1051_2.png) [@Exapno\_Mapcase](https://boards.straightdope.com/u/Exapno_Mapcase)\
**Post date:** [June 8, 2004, 12:43am UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/14 "2004-06-08T00:43:23Z")

</div>

BTW, please note that not only will the complete works of Shakespeare show up in English, they will also show up in all other languages that use the Latin characters of the standard QUERTY keyboard. And in every variation of length, wording, and spelling that has ever existed

And all of Shakespeare’s sonnets will show up, the contents of his will, all the plays that he contributed to, all the plays he acted in, all of his lost works, all the words he ever said in his lifetime, and all the words of the references he used for research. In all languages.

It might take many, many times the expected life of a finite universe to achieve all these, but there is no upper limit on BIG.

---

<div class="post-metadata">

**Author:** ![Eegba](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@Eegba](https://boards.straightdope.com/u/Eegba)\
**Post date:** [June 8, 2004, 1:09am UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/15 "2004-06-08T01:09:27Z")

</div>

And of course, the [Brunching Shuttlecocks](http://www.brunching.com/randommonkeys.html) have already covered this…

---

<div class="post-metadata">

**Author:** ![Backwater\_Under\_Duck](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Backwater\_Under\_Duck](https://boards.straightdope.com/u/Backwater_Under_Duck)\
**Post date:** [June 8, 2004, 1:11am UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/16 "2004-06-08T01:11:31Z")

</div>

And after doing Shakespeare, they would go on to type all of Bananarama’s songs 😃

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [June 8, 2004, 1:50am UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/17 "2004-06-08T01:50:28Z")

</div>

Two thoughts:

First, it is very likely that an infinite number of monkeys with keyboards would produce the complete works of William Shakespeare given an infinite amount of time. That doesn’t mean it’s guaranteed to happen–maybe they keep calling Hamlet Piglet.

Second, in what sense are the works of Shakespeare not random? This is a serious question. You and I can read them, but is there any kind of pattern to the bits that make them up?

---

<div class="post-metadata">

**Author:** ![CalMeacham](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/calmeacham/32/35_2.png) [@CalMeacham](https://boards.straightdope.com/u/CalMeacham)\
**Post date:** [June 8, 2004, 3:47am UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/18 "2004-06-08T03:47:41Z")

</div>

Ah, Ha! Found it.

The article is **How Artificial is Intelligence** by W.R. Bennett, Jr. , who was at Yale when he wrote it in 1977 (American Scientist, Vol. 65, #6, pp. 694-702 Nov-Dec 1977)

Third-Order Shakespeare Monkeys produced: “Hamlet of Twe as to be Murgains Fart Asse Give Onegs Love Gody Be…”

Fourth Order Shakespeare Monkey produced “A Go This Babe and Judgment of Timedious Retch and not Lord Whal if the Easelves and do and make and ease Gathem…”

As he noted, quoting an old Bob Newhart stand-up rutine, the monkeys were far more ikely to produce something like "To Be, or Not to Be, that is the Gesornenplatz…"than a line of actual Shakespeare.

---

<div class="post-metadata">

**Author:** ![MikeS](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@MikeS](https://boards.straightdope.com/u/MikeS)\
**Post date:** [June 8, 2004, 12:42pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/19 "2004-06-08T12:42:00Z")

</div>

“Here, then, is a [list](http://www.brunching.com/randommonkeys.html) of things our theoretical monkeys are — mathematically speaking — likely to come up with long before they finish _Hamlet_.”

---

<div class="post-metadata">

**Author:** ![SCSimmons](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@SCSimmons](https://boards.straightdope.com/u/SCSimmons)\
**Post date:** [June 8, 2004, 12:52pm UTC](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129/20 "2004-06-08T12:52:29Z")

</div>

> [@MikeS](#):
>
> “Here, then, is a [list](http://www.brunching.com/randommonkeys.html) of things our theoretical monkeys are ? mathematically speaking ? likely to come up with long before they finish _Hamlet_.”

**Eegba** beat you. And me, for that matter …

Still, nice link. 🙂

> [@Lore](#):
>
> \*A long Usenet argument over whether Boba Fett is alive, complete with spam-blocked e-mail addresses.   
> \*The phrase “Jesus Christ my ass is chafed” repeated for the length of two letter-sized pages.

[Next page](https://boards.straightdope.com/t/millions-of-monkeys-a-q-of-chance/249129.md?page=2)
