HomeBoard Games & Game MathematicsDice & Probability

🎲 Dice & Probability

Interactive dice probability simulator: roll n dice with s sides and watch the sum distribution converge to a Gaussian (central limit theorem). Compare the exact theoretical PMF with the empirical histogram, plus casino bet odds and expected values.

Board Games & Game Mathematics3DEasy60 FPS
dice-probability ↗ Open standalone

About the Dice & Probability Simulator

This simulator shows how the sum of n dice, each with s equally likely faces, is distributed. The exact probability mass function is the n-fold convolution of a single die's uniform distribution, computed here by counting the coefficients of the polynomial expansion. As more dice are added, this discrete distribution narrows in relative spread and approaches a smooth bell curve, the practical statement of the central limit theorem.

The controls set the number of dice (1 to 10), the sides per die (d2 to d20), and the auto-roll speed in rolls per second. Roll buttons add 1, 100 or 10,000 random outcomes, building an empirical histogram alongside the exact red bars, the yellow exact PMF and an optional cyan Gaussian. The same convolution maths underpins casino odds, risk modelling and any sum of independent random quantities, which is why dice are a classic teaching tool.

Frequently Asked Questions

What does this simulator actually compute?

It computes the probability of every possible total when you roll n dice of s sides. It draws the exact theoretical distribution, an empirical histogram from simulated rolls, and a matching Gaussian curve, so you can compare theory with experiment side by side.

What is the mean and variance of the sum?

A single fair die has mean (s+1)/2 and variance (s squared minus 1)/12. By linearity the sum of n dice has mean n times (s+1)/2 and variance n times (s squared minus 1)/12. For two ordinary six-sided dice this gives a mean of 7 and a variance of about 5.83.

How is the exact distribution calculated?

The single-die distribution is uniform over its faces. The simulator repeatedly convolves it with itself, once for each extra die, by counting how many face combinations produce each total. Dividing by s to the power n turns those counts into probabilities, giving the precise probability mass function with no approximation.

Why does the distribution become bell-shaped?

This is the central limit theorem in action. When you add many independent identically distributed random variables, their sum tends towards a normal distribution regardless of the original shape. Even with a flat single-die distribution, summing several dice produces an increasingly symmetric bell curve.

Why is 7 the most likely total with two six-sided dice?

Seven can be made in six different ways (1+6, 2+5, 3+4 and their reverses), more than any other total, so it has probability 6/36, about 16.7 per cent. Extreme totals like 2 or 12 can each be made only one way, giving probability 1/36, so the distribution peaks in the middle.

What do the empirical mean and variance show?

They are calculated from your actual simulated rolls. As the total number of rolls grows they converge towards the theoretical mean and variance. This is the law of large numbers, and it is why rolling 10,000 times produces a histogram that hugs the exact distribution far better than a handful of rolls.

Is the Gaussian overlay exact?

No, it is an approximation. The Gaussian uses the same mean and variance as the true distribution but is a continuous curve, while dice totals are discrete. For one or two dice it fits poorly, but for several dice the agreement becomes very close, which the overlay lets you see directly.

How are the casino odds in the table worked out?

They use the exact two-dice distribution. For example a bet on a total of 7 wins with probability 6/36, and snake eyes (a total of 2) wins with probability 1/36. The expected value column multiplies the payout odds by the win probability and subtracts the stake to show the long-run edge.

What does the craps pass line probability of 244/495 mean?

It is the exact chance of winning a pass line bet at craps, accounting for the come-out roll and the point phase. At about 49.3 per cent it falls just short of an even chance, which is why the pass line carries a small negative expected value and the house keeps an edge.

Are the simulated rolls truly random?

They use the browser's Math.random pseudo-random generator, which is fast and statistically uniform enough for visualising probability but is not cryptographically secure. Over many rolls the outcomes are indistinguishable from fair dice, which is exactly what you need to demonstrate convergence to the theoretical distribution.

⚙ Under the hood

Roll n dice and watch the sum distribution approach a Gaussian (central limit theorem). Compares the exact convolution PMF, the empirical histogram and casino bet odds with expected values.

ProbabilityDiceCentral Limit TheoremLaw of Large NumbersExpected Value

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)