The infinite monkey theorem is the mathematical theorem that suggests that a monkey pressing the keys of a typewriter indiscriminately for an infinite period of time can write a given text (for example, all of William Shakespeare's works) with almost certainty. In this context, the phrase "almost certain" is a mathematical term, and "ape" refers to an abstract apparatus that produces a string of random letters forever rather than a real monkey. The Theorem draws attention to the risks of reasoning about infinity by imagining a very large but finite number. The probability that a monkey could write a work like Shakespeare's Hamlet in exactly the same way is so small that the chances of this happening in a time on the scale of the age of the universe are negligible, but not zero.