Back to Random Tools

Free Dice Roller — D&D 5e, RPG Dice Notation, CSPRNG-Fair | Vectobox

Roll virtual d4-d100 dice for D&D, Pathfinder, and any TTRPG. Supports full dice notation (4d6kh3, 2d20kl1, 3d6!), advantage/disadvantage, exploding dice, and the D&D 5e stat array. Powered by Web Crypto rejection sampling for true fairness — no Math.random modulo bias.

CSPRNG
Quick Roll0 rolled
Count
1 – 100 dice per roll
Statistics0 rolls

Need at least 30 rolls to compute a chi-square fairness check.

Web Crypto rejection sampling — no modulo bias

ECMAScript `Math.random()` is implementation-defined and not required to be cryptographically secure (V8 uses xorshift128+). The classic `Math.floor(Math.random() * N) + 1` pattern also introduces a tiny but real modulo bias whenever N is not a power of two — for a d100 the bias is small (96 / 2³² ≈ 2.2×10⁻⁸) but non-zero. This roller uses `crypto.getRandomValues(new Uint32Array(1))` (W3C Web Crypto API) and Daniel Lemire's 2019 rejection-sampling trick: draws ≥ ⌊2³² / N⌋ × N are rejected and re-drawn so every face has probability exactly 1/N.

Full dice notation

The expression parser implements the de-facto TTRPG dice notation: `NdX` for N dice of X sides, `kh`/`kl` to keep highest/lowest, `dh`/`dl` to drop, `!` for exploding (Savage Worlds Acing), `!!` for compounding explode, `r` for reroll, and `>=N` for success counting (Shadowrun / WoD pools). Constant bonuses and additive composition work too: `2d6-1d4+3` is a valid penalty expression.

Live fairness check

Every kept face feeds an incremental histogram. Once you have ≥ 30 rolls of a given die size, a Pearson χ² goodness-of-fit test runs (uniform expected, df = N − 1) and a p-value from the regularized incomplete gamma function tells you whether the observed distribution is consistent with uniformity. Toggle off CSPRNG to see a `Math.random` comparison.

Privacy & scope

Every roll, log entry, and statistic stays in your browser via `localStorage` — there are no network requests, no analytics on your rolls. This tool is for entertainment and educational use; it is not a gambling product.

FAQ

Is this dice roller truly random?
Yes. Rolls use the W3C Web Crypto API (`crypto.getRandomValues`) which is a CSPRNG, combined with Lemire's rejection sampling so every face has probability exactly 1/N. The Statistics panel shows the rejection counters so you can verify in real time.
What is dice notation? How do I write 4d6kh3?
`4d6kh3` means: roll 4 six-sided dice, keep the highest 3, sum them. It is the canonical D&D 5e ability-score method. The parser also supports `kl` (keep lowest), `dh` / `dl` (drop highest/lowest), `!` (explode on max), `!!` (compound explode), `r1` (reroll on 1), `>=5` (count successes), and bonuses like `+2` / `-1d4`.
Why is Math.random not safe for dice rolling?
ECMAScript only requires `Math.random()` to be "approximately uniform" — V8 implements it with xorshift128+, which is fast but not a CSPRNG and is observable / predictable in adversarial settings. The classic `Math.floor(Math.random() * N) + 1` mapping also has a small modulo bias for any N that does not divide 2³². For casual rolls the bias is invisible, but the principled fix is `crypto.getRandomValues` + rejection sampling, which costs effectively nothing in modern browsers.
How do I roll D&D 5e ability scores?
Open the Notation tab and click "D&D 5e Stat Array". The tool rolls `4d6kh3` six times and shows the six scores, their mean and standard deviation, and the theoretical reference values (mean = 15869/1296 ≈ 12.24, σ ≈ 2.85).
What is advantage/disadvantage in 5e?
In D&D 5e advantage means rolling 2d20 and keeping the higher (`2d20kh1`); disadvantage keeps the lower (`2d20kl1`). The toolbar buttons on the Quick Roll tab are shortcuts for those two expressions. The expected value of advantage is 13.825, disadvantage is 7.175 (versus 10.5 for a flat d20).
How does exploding dice (Savage Worlds Ace) work?
When a die rolls its maximum face, you roll it again and add the result; if that rolls max again, you keep going. Notation: `1d6!` is one exploding d6. The expected value of `1d6!` is exactly 4.2 (geometric series: 3.5 / (1 − 1/6)). A safety cap of 50 explosions per die prevents pathological inputs.

Related Tools