Mathematics · chance

Dice Roller & Coin Toss

Roll it, and see the distribution it came from — including the ones that break your intuition.
exact distributions, not simulations
2d6 · sum

A die is a physical object and a probability distribution at the same time. Most rollers show you the object. This one shows you both — the exact distribution behind every roll, computed by convolution rather than by simulating it, next to the rolls you actually got.

Roll

Every die is added together.

Is it fair?

Every single die you roll is counted here, face by face, and tested against the flat distribution a fair die would give. This is a real chi-squared goodness-of-fit test — the same one used to check a casino's dice.

Roll some dice.

On the table

press roll

What you rolled, against what you should

Grey is the exact probability of each total. Coral is how often you actually rolled it.

One die is flat. Two is a triangle. Five is a bell.

This is the whole reason a game that wants a reliable result rolls several dice and adds them, and a game that wants drama rolls one big one. A single die is perfectly flat — a 1 is exactly as likely as a 20. Add a second and the flat top collapses into a triangle, because there are six ways to make 7 and only one to make 12. By five dice you have a bell, and the extremes have all but vanished.

Nothing here is simulated. Each curve is the exact distribution, built by convolving the single-die distribution with itself once per die — the same operation that makes the central limit theorem happen, done by hand.

The spread grows as √n while the total grows as n, so the result gets relatively tighter the more dice you add. That is the same square-root law that decides sample sizes in A/B testing and the width of the bell in Statistics & Probability.

Advantage helps least when you need it most

Roll two dice, keep the better one. It is the cleanest good idea in modern tabletop games, and almost everybody misreads it: they assume it is worth a flat bonus, something like +5. It is not. It is worth nothing at all when you were going to succeed anyway, nothing when you had no chance, and +25 percentage points exactly in the middle.

The reason is that keeping the highest of two turns your chance p of failing into p². Squaring a number near 0 or near 1 barely moves it. Squaring ½ moves it to ¼.

Mean of a flat d20 is 10.5; with advantage 13.825; with disadvantage 7.175. Those two sum to 21, because the best of two and the worst of two are mirror images.

Four dice, and every one of them loses

Here is the result that should not be allowed. Four dice, marked as below. A beats B two times in three. B beats C two times in three. C beats D two times in three. And D beats A two times in three. There is no best die. Whichever you choose, the other player picks the one that beats it — so always let them choose first.

"Beats" is not transitive, even though "is taller than" and "is heavier than" are, and that is the whole trap. Worse: die A has the lowest average of the four and still beats B two times in three. An average is a summary of a distribution, and a summary is not the thing.

Pick your die, then pick your opponent's.

The other pair of dice that behaves exactly like 2d6

Number one die 1, 2, 2, 3, 3, 4 and the other 1, 3, 4, 5, 6, 8. Roll them and add. Seven is still the most likely total, at exactly 6 chances in 36. Two and twelve are still 1 in 36. Every total, every probability, identical to an ordinary pair — and these are the only other way to do it with positive whole numbers.

You could substitute them into a game of craps and the odds would not shift by a hair. The distribution does not know what is written on the faces.

Verified in dice_model.py: the two sum distributions are compared as exact fractions and are equal outcome for outcome.

Real coins look rigged

Ask somebody to fake a hundred coin flips and they will write far too few long runs, because a run of six heads feels like it cannot be chance. It is close to certain. In a hundred flips the longest run is usually six or seven, and the rule of thumb is that it lands near log₂n — about 6.6 for a hundred, about 10 for a thousand.

This is also the honest answer to the gambler's fallacy. After five heads the next flip is still exactly 50/50. What changes with a longer session is not the coin, it is how much room there is for a long run to appear somewhere in it.

How this works

The distributions on this page are exact, not sampled. The chance of each total is built by convolution: start with the flat distribution of one die, and for every extra die combine it with the running total, adding probabilities for every way each sum can be reached. Keep-highest and keep-lowest are computed by enumerating the order statistics rather than by rolling, so a curve is right on the first frame instead of settling towards right.

The rolls themselves come from crypto.getRandomValues, the browser's cryptographic random source, not from Math.random. Bytes are drawn and any value in the final incomplete block is rejected and redrawn, because taking a remainder of 256 by 6 would make faces 1 and 2 very slightly more likely than 5 and 6 — a real bias, about 1.6% on a d6, and exactly the kind of thing this site exists to point at.

The fairness test is Pearson's chi-squared: sum the squared difference between observed and expected counts, divided by expected, and compare against the 5% critical value for the right number of degrees of freedom. It needs a few hundred rolls before it can say anything, and the page says so rather than pretending otherwise.

What this page assumes

Ideal dice: every face equally likely, every roll independent of the last. A real die has rounded corners, drilled pips that remove slightly more material from the six than the one, and a cup and a table that it interacts with — casino dice are machined flat, sharp-edged and have filled pips precisely because of this. Not modelled: physical bias, spin, throw technique, dice that are deliberately loaded, or a coin's small tendency to land on the face it started on. The chi-squared verdict here tests the numbers this page generated, which are as fair as the browser's cryptographic random source; it is a demonstration of the test, not a certification of any physical die you own.

Field notes

Roll more dice for reliability, one for drama

3d6 clusters hard around 10 and 11; 1d20 is as likely to give 1 as 20. Neither is better — they answer different questions. If you want a result that mostly behaves, add dice.

An average is not a distribution

Efron's dice have different averages and the one with the lowest average still wins two times in three against the next in the cycle. Any time a decision rests on comparing two means, ask what the spread is doing.

Advantage is worth most at even odds

It converts a failure chance p into p². That is worth 25 points at a coin-flip and almost nothing at either extreme, so it helps precisely when the outcome was least certain.

Long runs are normal

The longest run of heads in n flips sits near log₂n. Six in a row out of a hundred is the ordinary case, not evidence of anything.

Version history · unchanged

No changes to this tool’s own behaviour since the earliest archived release (v3.26). The full history for the site is in the changelog.