Chapters 23 and 24 of Hello World are about random numbers and the basics of Monte-Carlo simulations.
Monte-Carlo simulations rely on random sampling to obtain numerical results. This can be a useful alternative to analytical statistical methods, especially in very complicated cases. The Turing example in the introduction constitutes a Monte-Carlo simulation. Another example is given here.
Mendel studied 7 traits for his famous studies on peas: flower position, flower color, plant height, pea shape, pea color, pod shape, and pod color. He performed monohybrid crosses between plants that are homozygous for the trait. Thus, in the F1 generation, all plants have the dominant phenotype. He then selfed these plants and determined the ratio between plants with the dominant and those with the recessive phenotype. The theoretically expected ratio is 3:1 in this case. Then he selected F2 plants with a dominant phenotype and selfed these plants. He subsequently determined the ratio between F2 plants that give rise to F3 plants with both phenotypes and those that give rise to F3 plants with the dominant phenotype only. The expected ratio is 2:1 in this case. His results are shown in this table (modified from Fairbanks and Rytting, 2001).
Simulate each of these of experiments 1000 times and evaluate how many times the simulated experiments are closer to the expected theoretical outcome.
More details:
Useful function:
abs(): absolute value
Further reading: Original paper by Mendel; Discussion of controversies