The infinite monkey theorem says that a monkey randomly hitting keys on a typewriter will eventually type out one of William Shakespeare 's works . 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 given text , such as the complete works of William Shakespeare .