From Wikipedia:

The infinite monkey theorem states that 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. In this context, “almost surely” is a mathematical term with a precise meaning, and the “monkey” is not an actual monkey; rather, it is a metaphor for an abstract device that produces a random sequence of letters ad infinitum. The theorem illustrates the perils of reasoning about infinity by imagining a vast but finite number, and vice versa. The probability of a monkey typing a given string of text as long as, say, Hamlet is so tiny that, were the experiment conducted, the chance of it actually occurring during a span of time of the order of the age of the universe is minuscule but not zero.

Variants of the theorem include multiple and even infinitely many typists, and the target text varies between an entire library and a single sentence. The history of these statements can be traced back to Aristotle’s Metaphysics and Cicero’s De natura deorum, through Blaise Pascal and Jonathan Swift, and finally to modern statements with their iconic typewriters. In the early 20th century, Ã‰mile Borel and Arthur Eddington used the theorem to illustrate the timescales implicit in the foundations of statistical mechanics. Various Christian apologists on the one hand, and Richard Dawkins on the other, have argued about the appropriateness of the monkeys as a metaphor for evolution.

Today, popular interest in the typing monkeys is sustained by numerous appearances in literature, television and radio, music, and the Internet. A “Monkey Shakespeare Simulator” website got as far as 24 characters with “RUMOUR. Open your ears; “. In 2003 a humorous experiment was performed with six Sulawesi crested macaques, but their literary contribution was five pages consisting largely of the letter S.