2D Galton Board Canvas2D
Binomial PMF Gaussian approximation
Balls fall through pegs, bouncing left/right with probability (1-p)/p, and accumulate into the bottom bins.

About the 2D Galton Board

This is the classic side-view Galton board (bean machine), rendered directly on a 2D canvas the way it appears in every probability textbook: balls fall from a single point at the top, bounce left or right at each row of pegs in a triangular array, and pile up into a histogram of bins at the bottom. Each peg encounter is an independent random binary choice, so after N rows a ball's final bin is the sum of N independent left/right steps — exactly the setup behind the binomial distribution.

With the bias probability p left at 0.5, the histogram of accumulated balls converges toward the symmetric binomial B(n, 0.5), which for large n is well approximated by a Gaussian with mean μ = np and standard deviation σ = √(np(1-p)), drawn here as the dashed red curve against the solid blue theoretical binomial line. Moving the bias slider away from 0.5 skews the distribution while it stays bell-shaped — a direct illustration of the Central Limit Theorem holding for any fixed per-peg probability, not only a fair 50/50 split.

Use the row-count slider to change how many binary decisions each ball makes, the bias slider to weight the left/right split, and the drop-rate slider together with auto-drop to build up a large sample quickly. The live HUD tracks the empirical mean and standard deviation against their theoretical values as more balls accumulate.