DevTools Logo
All posts

Fair Random Picks With crypto.getRandomValues

August 28, 2026 · DevTools

random
decision-wheel
crypto
fairness

Most "random picker" tools reach for Math.random() without a second thought. The Decision Wheel & Picker uses the browser's crypto.getRandomValues() instead — the same cryptographically strong random source used to generate session tokens and keys — to spin the wheel and land on one entry from your list, quietly falling back to Math.random() only on the rare browser where the Crypto API isn't exposed.

Does the difference actually matter here

For picking a restaurant among friends, no — Math.random()'s pseudo-randomness is statistically fine for casual use, and nobody's incentivized to predict or manipulate it. The reason to default to crypto.getRandomValues() anyway is that Math.random()'s underlying algorithm (commonly xorshift128+ in V8) is deterministic and, with enough observed outputs, theoretically predictable — a property that matters not at all for a lunch decision, but costs nothing to avoid by using the stronger primitive from the start. It's a "why not" default, not a response to a real threat model for this particular tool.

How the spin animation stays honest

The wheel's landing segment is decided by the random draw first; the spin animation is then calculated to land visually on that predetermined result, not the other way around. That ordering matters — if the animation "decided" the outcome by wherever it happened to stop, the visual easing curve could introduce its own subtle bias toward certain segments.

When you want dice or a number instead

For tabletop-style rolls with dice notation, the 3D Dice Roller & Coin Flip covers that; for picking a number in a range or a single raffle winner from a longer list, the Random Number & Raffle Picker is built for exactly that case, using the same crypto-backed randomness underneath.