Dice - Polyhedral Dice Roller
Use this dice roller to roll virtual sets online. Choose any number of dice and sides, run multi-roll batches, and read the sequence plus a frequency table.
Dice
Results
What this tool does
A dice roller is a virtual set of polyhedral pieces you can roll from a web page instead of carrying physical sets to a game table. The form below takes the count, faces per piece, batch size, and optional seed for reproducible results. Every input change reruns the batch and refreshes the sequence and frequency table, so you can read outcomes at a glance.
- • Tabletop game sessions: Roll any combination of polyhedral pieces for a Dungeons and Dragons or board game session without physical sets of every shape.
- • Classroom demonstrations: Show how rolling n pieces of m faces approaches the theoretical distribution as the batch grows.
- • Probability experiments: Run a Monte Carlo batch and read the frequency table side-by-side with the expected mean and modal sum.
- • Reproducible practice: Enter a seed to regenerate the same sequence when you need to repeat a teaching demo or a tournament run.
Each roll sums n independent discrete uniform faces from 1 to s, so r rolls produce r independent copies of that distribution. The roller draws n faces per roll, updates a frequency counter, and reports the mean and modal sum.
If you only need the theoretical probability of a particular sum, the probability calculator handles that without random draws. The roller is the simulation half of that workflow.
When the question is the theoretical probability of a target sum with n pieces of s faces instead of an actual sequence, Dice Calculator returns exact, at-least, and at-most probabilities from the closed-form distribution.
How the random draw works
The roller draws n uniform random numbers per roll and scales each to an integer face value from 1 to s. Adding the n face values gives the roll sum. Repeating that for r rolls produces the full sequence and the frequency table that aggregates each sum.
- n: Pieces rolled per roll. Integer from 1 to 100, default 2.
- s: Faces per piece. Integer from 2 to 100; 4, 6, 8, 10, 12, and 20 cover common polyhedral shapes.
- r: Independent rolls in the batch. Integer from 1 to 10000, default 10.
- seed: Optional integer that seeds a deterministic pseudo-random sequence. Empty or zero falls back to Math.random.
The random number comes from Math.random() in the browser when no seed is provided, or from a small mulberry32 pseudo-random generator when a seed is provided. mulberry32 returns floats in [0, 1). The same seed always returns the same sequence, so reproducibility is built into the tool.
After each roll the sum is added to the sequence, frequency counter, and running total. The mean equals the total divided by r, and the modal sum is the value with the highest counter.
Worked example: 2d6, 10 rolls, seed 1234
n = 2, s = 6, r = 10, seed = 1234
face_i = floor(u_i * 6) + 1; roll_sum = face_1 + face_2.
A sequence of 10 sums in [2, 12] such as 7 4 9 5 11 3 8 6 10 7 with mean around 7.2 and modal sum 7.
According to MDN Web Docs, Math.random, Math.random returns a floating-point, pseudo-random number in the range 0 to 1 (inclusive of 0, exclusive of 1), which is the uniform draw the roller scales up to a face value with floor(u * s) + 1.
For a focused two-piece simulator that tracks doubles and snake eyes alongside the frequency table, 2 Dice Roller Calculator is a tighter alternative when n is fixed at 2 and s is fixed at 6.
Key concepts behind the roll
Four ideas make the roller behave the way you expect. Each explains a small piece of how a virtual polyhedral roll turns into a sequence, a frequency table, and a summary.
Discrete uniform face
Each face is a discrete uniform random variable: every face from 1 to s has probability 1/s. The roller draws one such face per piece per roll, so the building block of the sequence is just a fair pick over s possibilities.
Sum of independent rolls
Rolling n pieces adds n independent discrete uniform variables. The sum is the well-known n-piece distribution, a triangle for small n and a near-normal bell for large n.
Independence between rolls
Each roll uses a fresh set of random draws and does not look at any previous roll. That independence keeps the long-run mean close to n times the single-piece expected value of (s + 1) / 2.
Deterministic seed
A seed turns the random sequence into a deterministic one. With the same seed the roller always returns the same sequence of sums, which is the simplest way to repeat a board-game session or a classroom demo exactly.
Independence is the assumption most often broken in real experiments. Drawing pieces without releasing them, sharing a piece with a known face, or stopping after a streak all break independence. The form assumes true independence; treating the output any other way needs a different model.
The seed concept is borrowed from pseudo-random number generators. Math.random() uses an internal seed that the browser does not expose, which is why two empty-seed runs almost never repeat. Entering an explicit seed overrides that behavior.
Once the roller produces a batch, Two Dice Probability Calculator can compare the realized frequency table to the closed-form sum distribution for the simplest polyhedral case (n = 2, s = 6).
How to use the simulator
Set the four inputs, then read the roll sequence, the summary numbers, and the frequency table. The form updates on every input change, so adjusting the count, the sides, or the seed reruns the batch without any click.
- 1 Enter the number of pieces: Type the integer n. Default 2; accepts 1 to 100.
- 2 Choose the sides per piece: Type the integer s. Use 4, 6, 8, 10, 12, or 20 for common polyhedral shapes, or any integer from 2 to 100.
- 3 Set the number of rolls: Choose how many independent rolls r to simulate. Default 10; accepts 1 to 10000.
- 4 Optionally enter a seed: Any integer reproduces the same sequence. Leave empty for a fresh batch on every change.
- 5 Read the roll sequence: Each roll sum appears separated by spaces. Long sequences wrap to fit on a phone screen.
- 6 Check the mean and modal sum: Use the mean to verify the realized average. The modal sum is the value that came up most often.
- 7 Reset for the next batch: Reset restores n = 2, s = 6, r = 10, empty seed and starts a new sequence.
For a quick Dungeons and Dragons attack roll, set n = 1, s = 20, r = 1, leave the seed empty, and read the first number in the sequence. For a Monte Carlo demo, set n = 2, s = 6, r = 1000: 7 should come up far more often than 2 or 12.
After the roller returns the realized modal sum and frequency table, Binomial Distribution Calculator can compare the count of a single face against the binomial distribution for the same n and p.
Benefits of using this simulator
The roller combines an n-piece configuration, an s-sided face choice, a multi-roll batch, an optional seed, and a frequency table in one form for the most common tabletop and classroom questions.
- • Any polyhedral shape: 4, 6, 8, 10, 12, 20 for common sets, or any integer from 2 to 100 for a custom shape.
- • Any count: 1 piece for a single check or 100 pieces for a stress test. The form handles every n from 1 to 100.
- • Reproducible sequences: the optional seed turns the batch into a deterministic one. Use the same seed on a second visit to reproduce the same sequence.
- • Frequency table plus summary numbers: mean, modal sum, roll count, and the full sum-by-sum frequency table are readable at a glance.
- • Real-time updates: the form recomputes on every input change, so adjusting n, s, r, or the seed shows the new outcome immediately.
The most common use of a roller is a single check, but the same form scales up to multi-roll experiments because the math is identical.
When the realized modal sum looks unusual, the same frequency table feeds into a binomial analysis. Cross-checking the realized frequency of a single sum against the theoretical mean is the fastest way to spot a typo in s.
If a single face count from the frequency table needs to be turned into a probability statement, Probability Calculator covers the same calculation in a different form.
Factors that affect the results
The numbers from the roller are only as accurate as the assumptions behind each face. Four practical factors change what the sequence means.
Number of pieces
More pieces widen the sum range from n to n * s and pull the distribution toward a bell curve. Rolling 1 piece gives a flat uniform shape; 5 pieces of 6 faces give a near-normal shape from 5 to 30.
Sides per piece
The face probability 1/s sets the spread. A d20 has probability 1/20 = 0.05 per face; a d6 has 1/6 = 0.1667 per face. Higher s means flatter single-piece behavior and a wider sum range.
Batch size
A small batch can swing away from the expected mean. With n = 2 and s = 6, ten rolls often produce a mean anywhere from 5 to 9, while a thousand rolls stay much closer to 7.
Pseudo-random quality
Math.random() is fine for a virtual roller, but it is not cryptographically secure. Use the seed field if the result has to be reproducible; use a dedicated source if it has to resist prediction.
- • The roller runs in your browser and uses Math.random() by default. Two empty-seed visits will produce different sequences, by design.
- • The form caps the batch at 10000 rolls to keep rendering fast. Larger experiments should be split into multiple batches.
- • The roller does not show the underlying random draws. The seed field lets you reproduce the exact sequence; without a seed, the same unusual outcome is unlikely to recur.
Real physical sets are slightly biased in practice, so an observed frequency that drifts from 1/s is normal in a careful experiment, and the seed plus frequency table make that drift visible.
For tabletop or classroom use Math.random() is plenty; for security-sensitive draws, replace the roller with a true random source.
According to Wikipedia, Dice, common polyhedral sets include 4-sided (tetrahedron), 6-sided (cube), 8-sided (octahedron), 10-sided (decahedron), 12-sided (dodecahedron), and 20-sided (icosahedron) shapes, accepted directly through the sides-per-piece field.
According to the NIST/SEMATECH e-Handbook of Statistical Methods, a single roll is a discrete uniform random variable over the faces, and rolling n pieces produces the sum of n independent discrete uniform variables, the underlying model the form uses to compare the realized frequency table against the closed-form distribution.
For a binary random draw that uses the same uniform random idea as a single piece, Coin Flipper simulates Bernoulli trials and is the simplest comparison point for a d2 piece.
Frequently Asked Questions
Q: How does the dice roller decide each face?
A: The dice roller draws one uniform random number per die from the range 0 to 1 and scales it up to an integer face value from 1 to s with floor(u * s) + 1. Adding the n face values gives the roll sum. Repeating the draw for r rolls produces the full sequence and the frequency table.
Q: Can I roll more than two dice at a time?
A: Yes. Set the number of dice to any integer from 1 to 100 and the dice roller will roll that many independent dice per roll. Each roll sum is the total of all dice faces in that roll, and the frequency table covers every possible sum from n to n * s.
Q: Is the dice roller truly random?
A: By default the dice roller uses the browser Math.random function, which is a pseudo-random source suitable for tabletop games, classroom drawings, and Monte Carlo demos. For exact reproducibility, enter any integer in the seed field and the same sequence will be returned on every run.
Q: Which polyhedral dice can I simulate?
A: The sides-per-die field accepts any integer from 2 to 100. Common tabletop shapes include 4 (tetrahedron), 6 (cube), 8 (octahedron), 10 (decahedron), 12 (dodecahedron), and 20 (icosahedron). For a coin-style binary draw, set the sides to 2.
Q: Can I use the dice roller for a tabletop game?
A: Yes. For a single Dungeons and Dragons d20 attack roll, set the number of dice to 1, the sides to 20, the number of rolls to 1, and leave the seed empty, then read the first number in the sequence. For a multi-dice damage roll, set the number of dice to match the damage expression and the sides to the weapon's die.
Q: How long is the longest run of a single face I should expect?
A: For a fair die the expected longest run of a specific face grows like log base s of r, where s is the number of faces and r is the number of rolls. For s = 6 and r = 100 rolls, the expected longest run of face 1 is about 2.93 rolls. Streaks longer than that are uncommon but not impossible.