Sunday, July 6, 2008

The Infinite Monkey Theorem

Just a little while ago, I was reading about the Infinite Monkey Theorem, as a means of providing input to software tests, on Wikipedia that states: "a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type a particular chosen text, such as the complete works of william Shakespeare."

The explanation of the theorem clarifies that the behavior of the "monkey" is assumed to be something that can generate characters randomly. Stating that particular assumption does tend to pacify critics trying to discredit the theorem.

If you've observed child behavior, they initially repeat whatever seems to interest them. If they pressed the space bar and found the sound made by the keyboard interesting, they would continue to press the space bar to boredom. They will then try out some other keys at the center of the keyboard, or perhaps some toward the left and right edges too but they wouldn't usually get to the upper edge since those are farther away and less likely to be pressed... unless they push the keys in sequence (1, 2, 3, 4, 5, 6, 7, 8, 9, 0...) but that isn't random.

My nephew eventually got tired of pushing keys on the keyboard so the "infinite amount of time" part may be hard to test. He pushes the power button now because it gets the hard disk LED flashing and then eventually turns all the LEDs off :-(

No comments: