Dice Roller

Roll any number of dice with any number of sides — cryptographically random, with the total and a roll history.

1,092 views

How Fair Dice Rolls Work

Every roll on this page comes from crypto.getRandomValues() rather than Math.random(). The raw output is filtered with the same modulo-bias elimination used throughout this site's random-number tools: values that fall outside an exact multiple of the die's side count are discarded and re-drawn, so every face keeps exactly the same probability instead of the tiny skew that naive modulo division introduces at the edges of the range.

A single die is uniform — each face from 1 to N has the same 1/N chance, whether it's a standard six-sided die or a d20 for tabletop games. The moment you roll more than one die and look at the total, the picture changes completely. The sum of two six-sided dice is not uniform at all: it forms a triangular, bell-like distribution centered on 7. That's because there's only one way to make a 2 (1+1) or a 12 (6+6), but six different combinations make a 7 (1+6, 2+5, 3+4, 4+3, 5+2, 6+1). With three dice the pattern sharpens further — 10 and 11 become the most common totals, while 3 and 18 stay the rarest, because the number of ways to combine the faces grows in the middle and shrinks at the extremes.

What to Watch Out For

  • Combinatorics, not luck, explains the curve. This is the classic example of "counting combinations" in introductory probability — the total's distribution is exactly the number of dice-face combinations that produce each sum, divided by the total number of possible combinations (36 for two six-sided dice, 216 for three).
  • A "hot" or "cold" number over a handful of rolls means little. Because 7 has six times the combinations of 2, it will naturally appear more often even over a short session — that's expected variance, not a biased generator.
  • Custom-sided dice change the math. A d20's combinations spread the same way, but flatter — its middle values (10-11) are only marginally more likely than its extremes, unlike two d6s where the difference between the center and the edges is dramatic.
  • Everything runs client-side. No roll is sent to a server, and the roll history lets you check the actual spread against the theoretical distribution yourself.

Frequently Asked Questions

How is this different from Math.random()?

crypto.getRandomValues() draws from the operating system's cryptographic random source, and this tool discards any draw that would introduce modulo bias — every face has an exactly equal chance, which plain Math.random() does not guarantee at the edges of a range.

Why is rolling two dice and getting a 7 so much more common than getting a 2?

Because of combinations, not probability per die. Only one combination (1+1) produces 2, but six combinations (1+6, 2+5, 3+4, 4+3, 5+2, 6+1) produce 7 — so across 36 possible two-dice outcomes, a 7 is six times as likely as a 2.

Is a single die roll ever not uniform?

No — a fair single die always has exactly 1/N probability per face. It's only when you add multiple dice together and look at the sum that a bell-shaped, non-uniform distribution appears.

Can I roll non-standard dice like a d20?

Yes — set any number of sides from 2 up to 1000, useful for tabletop RPGs, board games, or any custom probability experiment.

Does the roll history prove the dice are fair?

Over enough rolls, yes — track the history and the observed frequency of each face (or each sum, for multiple dice) should converge toward the theoretical probability. Short sessions will show natural variance either way.

Comments

No comments yet — be the first to write one!

Similar Tools