Dice Roller
Roll virtual dice with realistic 3D animation. Choose from d4, d6, d8, d10, d12, or d20 dice and roll up to 6 at once. Perfect for tabletop RPGs, board games, or any situation needing dice simulation — powered by cryptographic randomness.
Dice Roller
Roll virtual 3D dice for RPGs, board games, and more
Dice Roller Simulator Overview
This dice roller simulator provides a realistic, physics-driven virtual dice experience for tabletop role-playing games, board games, and educational probability demonstrations. Built entirely with vanilla JavaScript and the Three.js 3D library, every roll runs locally in your browser using the Web Crypto API for cryptographically secure random number generation. No data is transmitted to any server, and no tracking scripts are involved — the 100% client-side architecture ensures complete privacy and zero latency.
The simulator supports all standard polyhedral dice used in RPG systems: d4, d4t (top-read), d6, d8, d10, d12, d20, and d% (percentile). Each die is rendered as a true three-dimensional object with face-specific textures, and the rolling animation uses quaternion-based spherical linear interpolation for smooth, natural tumbling. The results are displayed with a breakdown per die type, along with a roll history that tracks session statistics including average, minimum, and maximum values.
Real-World Applications and Use Cases
A Dungeon Master running a D&D session can roll initiative, saving throws, and damage dice for multiple creatures simultaneously. The ability to select and roll different die types in a single click saves time and maintains game flow, while the cryptographically secure randomness ensures fair outcomes for all players.
Statistics teachers can demonstrate the law of large numbers and probability distributions by rolling large volumes of dice and observing the frequency of each outcome. The roll history and session statistics provide immediate data for classroom analysis without needing physical dice.
Players of games that use non-standard dice combinations — such as Warhammer, Pathfinder, or custom tabletop systems — can quickly simulate complex rolls to test strategies, evaluate damage ranges, or resolve disputes about the rarity of specific outcomes.
Deep-Dive: Dice Roll Mechanics and Random Number Generation
The core randomness engine relies on crypto.getRandomValues(), the Web Crypto API's cryptographically secure pseudorandom number generator (CSPRNG). Unlike Math.random(), which uses a pseudo-random number generator seeded with the current timestamp, the Web Crypto API draws entropy from the operating system's secure random source — the same mechanism used by TLS/SSL protocols, password generators, and banking applications.
Fairness and Probability Model
Each die face has exactly 1/N probability, where N is the number of sides. For a d20, every face from 1 to 20 has a 5% chance. The implementation uses rejection sampling to eliminate modulo bias: when generating a random integer in a range that does not evenly divide 2^32, values exceeding the largest multiple of the range are discarded and re-rolled. This guarantees perfect uniform distribution across all supported die types, including edge cases like percentile dice where a d10 paired with a d% produces values from 0 to 99 with equal probability.
3D Rendering and Animation Pipeline
Each die is instantiated as a Three.js BufferGeometry with the correct number of faces: a tetrahedron for d4, a cube for d6, an octahedron for d8, a pentagonal trapezohedron for d10, a dodecahedron for d12, and an icosahedron for d20. Face textures are procedurally generated on a canvas element with purple gradient fills. The tumbling animation uses quaternion slerp (spherical linear interpolation) to rotate the die from a random starting orientation to the face corresponding to the rolled value over a 1.4-second duration. On completion, particle twinkles burst from the die using CSS keyframe animations with randomised delays and colours.
The Perfect 100 detection logic identifies when a d10 roll of 0 coincides with a d% roll of 00. These pairs are excluded from the additive total and replaced with a flat 100 bonus, accurately modelling the percentile convention used in games like Call of Cthulhu and Warhammer Fantasy Roleplay.
Frequently Asked Questions
Is the dice roll truly random?
Yes. Each roll uses the Web Crypto API's crypto.getRandomValues(), which is a cryptographically secure pseudorandom number generator. This is the same entropy source used by TLS/SSL encryption, password managers, and banking applications. It passes all standard randomness tests and is suitable for gaming, simulations, and statistical sampling.
Can I roll multiple die types at once?
Yes. Click multiple die type tags to select them, then use the +/- controls to set how many of each type — up to 6 per type and 12 dice total per roll. All selected dice will roll simultaneously and their results are displayed together, making it ideal for RPG turns that involve multiple damage dice, ability checks, or saving throws of different denominations.
What dice types are supported?
The roller supports all standard RPG dice: d4 (bottom-read tetrahedron), d4t (top-read tetrahedron), d6 (cube), d8 (octahedron), d10 (pentagonal trapezohedron), d12 (dodecahedron), d20 (icosahedron), and d% (percentile, numbered 00-90). The d4t variant uses a vertex-up orientation so the topmost number is read directly, while the standard d4 reads the number at the base.
What is a Perfect 100?
When rolling d10 and d% together, any pair where the d10 shows 0 and the d% shows 00 counts as a Perfect 100 — the maximum possible value. In percentile-based systems like Call of Cthulhu or Warhammer Fantasy Roleplay, this represents an exceptional success in skill checks. With multiple dice selected, each matching pair triggers independently.
Is this fair for actual gameplay?
Yes. Each face has exactly equal probability, enforced by the rejection-sampling technique that eliminates modulo bias. The randomness source is the same cryptographic API used by banking and security software, making the rolls provably fair for competitive play, tournament settings, and official RPG sessions where impartial outcomes are expected.
What happens if I exceed the 12-die limit?
The tool enforces a maximum of 12 dice per roll to maintain smooth 3D rendering performance in the browser. If your game requires more dice, you can run multiple rolls in sequence — the history section keeps a log of all previous results, including averages and extremes, so you can aggregate outcomes across multiple rolls manually.