Simulating the Dice, Many Times
Question 4 asked what happens at 1,000 or 10,000 rolls. Let's find out with code instead of by hand.
scripts/two-dice-simulation.py rolls two fair dice over and over and reports the observed distribution at checkpoints, next to the theoretical one (1/36, 2/36, 3/36, ...) — as text in the terminal, and as a bar chart that redraws live.
python3 scripts/two-dice-simulation.py --checkpoints 20 200 2000 20000
Watch what happens to the gap between the observed bars and the expected line as the count grows.
https://github.com/msu-cerl/cmse101/blob/main/scripts/two-dice-simulation.py