Expected Value Lab
A random variable is a list of outcomes with probabilities. Its expected value is where the bars balance; its variance is how far the mass sits from that point. Draw many times and watch the running mean settle on E[X]: slowly, with wobble of order SD/√n.
Payoff distribution: E[X] is the balance point
bar height = probability; drag a handle to change p (the others rescale)
Running mean of simulated draws
1,000 draws · log n
Simulated outcomes vs exact probabilities
outline = exact p
E[X] and Var(X) are exact sums over the table. Draws use a seeded generator; the shaded band in the running-mean plot is E ± 2·SD/√n (a CLT-style envelope, not a confidence interval about the data). Payoffs are hypothetical games, not empirical products.
After 1,000 draws the running mean is 3.55; E[X] = 3.50.
Formula
A game with positive E[X] can lose almost every time (lottery): the mean is pulled by a rare large payoff. The running mean converges to E[X], but the sum of winnings does not converge to anything.