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

Roll one die, two dice, or toss a coin. The odds behind whatever you rolled are underneath, worked out exactly rather than estimated — along with the dice that break your intuition, if you want them.

Roll

2 dice
press roll

More dice, modifiers and finishes

Every die is added together.

The odds behind what you just rolled

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

Is it fair?

Every individual die is counted here and tested against the flat distribution a fair die would give — a real chi-squared goodness-of-fit test.

Roll some dice.

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 throw is choreography, and the number comes first. The dice really are rigid bodies — gravity, a coefficient of restitution of 0.42, spin that gets kicked about on every bounce, integrated at a fixed 1/120 s step — but the face they land on is drawn before the throw starts, and the simulation is snapped to show it as it comes to rest. That is deliberate. If the tumble decided the outcome, the result would carry whatever bias lives in those constants instead of coming from the source below, and the fairness test further up this page would be measuring the integrator rather than the randomness.

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

What randomness actually looks like

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 · 8 releases
  1. v3.272026-08-16The dice page had eight things competing for the top of the screen and controls that matched no other page — the roll is now the whole hero
  2. v3.392026-08-17The dice are thrown for real — rigid bodies, gravity, bounce and spin — landing on a face the crypto source drew first
  3. v3.402026-08-17The camera was under the table, so the pips were painted on the hidden faces — that is why the values were unreadable
  4. v3.412026-08-17The depth sort was inverted so the far faces were painted over the near ones — the dice looked see-through — and the throw had no energy to bounce with
  5. v3.422026-08-17Pips were spheres glued to the faces, the second die rolled off the table, and the dice sank into the floor
  6. v3.432026-08-17The pips were screen-space circles, so they stayed round on faces turned away from you — they are geometry in the face plane now
  7. v3.462026-08-17Field-note cards used a container class that does not exist, on three pages — plus an atom key, particle counts, and a patterns panel that matches its bars
  8. v3.482026-08-18The steak cross-check had drifted for five releases; rebuilding it found a pull-point search that could not converge and four displays still quoting a figure the solver stopped using

Releases in which this page changed, newest last. Derived from the archived copy of every release, not from notes written afterwards — so it reflects what actually shipped. Site-wide passes are left out; they are in the full changelog.