This demonstration shows how completely random keystrokes (the “Monkey”)
struggle to find a specific text, while a genetic algorithm with
random mutation plus selection can reach that goal much faster.
In real evolution, there is no "predetermined target text".
Here, the "target text" is just a simplified representation of
environmental fitness.
No special parameters here. Each random string is compared to the best so far; if better, it becomes the new best.
Note: Neither approach fully models real-world evolution, since in nature there is no "predetermined target". Selection favors better adaptation to the current environment over generations, leading to complex changes. This example simply illustrates how "randomness + selection" can vastly outperform pure randomness. We assume an average monkey lifespan of ~32-35 years for demonstration.