A mystery-box game pays $100 with 5 percent probability, $5 with 25 percent, and $0 otherwise. The expectation, the sum of probability times payout, is $6.25 per play. Buttons draw 1, 100, or 5,000 random plays and a chart plots the running average, which thrashes at first and then settles onto a dashed line at the expectation. Two sliders change the probabilities, moving the expectation line and resetting the run, showing that expectation is not the next outcome but the value the long-run average converges to.

The long-run average

A mystery box pays $100 rarely, $5 sometimes, $0 mostly. The expectation E[X] = Σ p·x is one fixed number — not what the next box holds, but where the running average is forced to end up.

$1005%
$525%
$070%
= the remainder

changing the odds resets the run

E = 0.05 × $100 + 0.25 × $5 + 0.70 × $0 = $6.25 per play
plays0
total winnings$0
average so far
expectation E[X] · target$6.25

The expectation is not what happens next — a single play is noise, usually $0. It's the number the average is forced toward as plays pile up. That's why sampling works at all: enough random draws recover the true average — the same license that lets a model learn from random batches instead of the whole world.