Number & Gaming

Dice Roller

Cryptographically uniform virtual dice roller supporting multiple dice and arbitrary side counts (d4, d6, d20, d100).

How It Works & Methodology

Virtual dice rolling requires statistically uniform pseudo-random number generation. Standard Math.random() can suffer from modulo bias when mapping floating numbers to discrete integers. This tool uses cryptographic rejection sampling over Web Crypto API random bytes, ensuring mathematically fair and unbiased roll outcomes.

Rejection Sampling: MaxUnbiased = Math.floor(2^32 / sides) * sides Generate uint32 -> If uint32 < MaxUnbiased, result = (uint32 % sides) + 1; otherwise redraw. Total = Sum of all individual dice rolls.
Key Assumptions & Scope:
  • Dice count is supported from 1 to 100 simultaneous dice.
  • Sides are supported from 2 up to 1,000 sides per die.
  • Each die roll is statistically independent with equal probability 1/sides.

Frequently Asked Questions

What is modulo bias and why does rejection sampling prevent it?

Modulo bias occurs when dividing a fixed range of binary numbers (like 256 or 2^32) by a side count that is not an exact divisor. Rejection sampling discards the remainder slice, guaranteeing equal probability for all faces.

Are popular tabletop gaming dice (d20, d100) supported?

Yes. Quick presets are available for d4, d6, d8, d10, d12, d20, and d100, or you can enter any custom side count up to 1,000.

Can I roll multiple dice at once?

Yes. You can roll between 1 and 100 dice in a single roll, viewing both the grand total sum and every individual die roll.