Millions of Monkeys - a Q of chance

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?

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.

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.

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.

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

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?

A) Yes your friend is wrong.

B) You may be interested in this java simulator, the Monkey Shakespeare Simulator. 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.

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.

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.

[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.

OK, who’s really typing this? :wink:

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

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.

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.

And of course, the Brunching Shuttlecocks have already covered this…

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

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?

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.

“Here, then, is a list 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. :slight_smile: