The More You Draw, the Closer the Average Gets
Flip a coin a few times and the fraction of heads jumps around, but flip it thousands of times and it settles near 0.5. The law of large numbers is this pull: as you gather more samples, the sample average converges to the true expected value E[X]. Run the law backward and you can estimate a hard-to-compute number from random samples, which is the Monte Carlo method. Across five figures we watch the average converge, throw darts to pin down π, measure how the error shrinks like 1/√n, see a histogram grow into a density curve, and confirm that different seeds share the same limit.
Score heads as 1 and tails as 0 and the coin has expected value E[X] = 0.5; for a die, the average pip is E[X] = 3.5. Drag the slider for the number of throws n and the running average up to that point is plotted. The first few throws swing wildly, but as n grows the curve hugs the dashed line at the expected value. Because we use a fixed seed, the same path appears every time you open it.
Throw darts all over the square [0,1]×[0,1]. The fraction that land inside the quarter-circle of radius 1 centered at the origin converges to its area, π/4. So multiplying the inside fraction by 4 gives an estimate of π. Raise the number of darts n and the dots fill in while the estimate tightens toward 3.14159. Measuring an area with random samples like this is the seed of Monte Carlo integration.
More samples help, but how fast? Plot the estimation error |estimate - true| against n and it shrinks at roughly the rate 1/√n. That means halving the error costs four times as many samples. Switch the guide line between 1/√n and 1/n: the real error trails the slow 1/√n, not the fast 1/n. It shows how expensive accuracy is.
Take one more step: it is not only the mean that converges. The whole histogram of n samples approaches the population probability density curve. When n is small the bars are jagged, but as n grows their outline settles onto the smooth density curve. Toggle between the normal and uniform distributions to check. This is why a histogram lets you read the shape of a distribution.
If it is random, how does the same picture come back every time? Our random numbers are a deterministic sequence fixed by a single seed, so the same seed rebuilds the same path. Change the seed and the early wobble differs for each, yet all paths gather at the same expected value 0.5. Randomness makes the paths differ; the law of large numbers makes the destination the same. That is how an experiment can be reproducible and still give a universal conclusion.