The Infinite Monkey Theorem is a proposition that an unlimited number of monkeys, given typewriters and sufficient time, will eventually produce a particular text, such as Hamlet or even the complete works of Shakespeare.
The reasoning behind that supposition is that, given infinite time, random input should produce all possible output. The Infinite Monkey Theorem translates to the idea that any problem can be solved, with the input of sufficient resources and time. In this context, “almost surely” is a mathematical term with a precise meaning, and the “monkey” is not an actual monkey, but a metaphor for an abstract device that produces an endless random sequence of letters and symbols. One of the first instances of the monkey metaphor being used comes from French mathematician Émile Borel in 1913 but it may go back further than that. The relevance of the theorem is questionable—the probability of a universe full of monkeys typing a complete work such as Shakespeare’s Hamlet is so tiny that the chance of it occurring during a period of time hundreds of thousands of orders of magnitude longer than the age of the universe is extremely low (but technically not zero).