How our random tools work
A plain-English account of where our randomness comes from and how we turn it into fair results, including the mistakes we deliberately avoid.
In short: every result comes from your browser’s cryptographically secure random generator. We convert it to your range with rejection sampling, so no outcome is favoured. No-repeat draws use the Fisher–Yates method. Results are decided before any animation, and nothing you type leaves your device.
1. Where the randomness comes from
We use the Web Cryptography API’s crypto.getRandomValues(), which every modern browser provides. Browsers back it with a cryptographically secure pseudo-random number generator, seeded from entropy collected by your operating system and hardware. That is the same quality of randomness used to create encryption keys, and much stronger than JavaScript’s Math.random(), which makes no security or quality guarantees.
It is still an algorithm: “cryptographically secure” means its output cannot practically be predicted or told apart from true randomness, not that it comes from a physical process. For games, classrooms and everyday decisions, that makes no practical difference.
2. Fitting randomness to your range without bias
The generator gives us whole numbers from 0 to 4,294,967,295 (232 − 1). The tempting way to get a number from 1 to 6 is to divide by 6, keep the remainder and add 1. But 232 doesn’t divide evenly by 6, so some remainders come up slightly more often than others. This is called modulo bias.
We use rejection sampling instead. We work out the largest multiple of your range size that fits below 232, throw away any raw value at or above it, and draw again. Every remaining value maps onto your range the same number of times, so each outcome is exactly equally likely. A redraw is rarely needed, never more than half the time. For ranges wider than 232, we combine two draws into a 53-bit value and apply the same rule.
3. Drawing without repeats
For “no repeats” we use the Fisher–Yates shuffle (in Durstenfeld’s in-place form), stopped after as many steps as you asked for. To draw 5 different numbers from a billion, we don’t build a billion-entry list: we track only the handful of positions that have been swapped. Every possible set of results, in every order, is equally likely.
If you ask for more different numbers than the range contains, say 11 unique numbers from 1 to 10, the tool tells you it is impossible. It never quietly returns duplicates or fewer results.
4. Weighted choices
When you set custom odds, for example on the yes or no generator, the weights must be whole numbers. We draw one fair random integer below the total weight and walk through the options until we reach the one whose share contains it. An option with weight 3 is exactly three times as likely as one with weight 1, and the page shows the resulting percentages.
5. The result comes first, then the animation
Rolling numbers, flipping coins and flickering answers are decoration. Each tool decides the result first, then animates towards it, and the final screen always shows the value that was drawn. If your device asks for reduced motion, results appear instantly. Screen readers hear only the final result.
6. Privacy
Everything runs in your browser. Lists, names, questions and results are not sent to us or to anyone else, and history lasts only for the current page visit. See our privacy notice.
7. What we test, and what we don’t claim
Our automated tests check every engine’s edge cases: equal bounds, negative numbers, huge ranges and impossible requests. They also force the rejection path and run statistical “smoke tests” to catch gross errors. Passing tests cannot prove randomness, and we have not had these tools independently audited. Don’t use them for lotteries, regulated prize draws, gambling or generating passwords and keys. Use a certified or purpose-built tool for those.
References
- W3C. Web Cryptography Level 2: Crypto.getRandomValues(). World Wide Web Consortium specification.
- MDN Web Docs. Crypto: getRandomValues() method.
- NIST. SP 800-90A Rev. 1: Recommendation for Random Number Generation Using Deterministic Random Bit Generators. 2015.
- Daniel Lemire. Fast Random Integer Generation in an Interval. ACM Transactions on Modeling and Computer Simulation 29(1), 2019 (discusses modulo bias and rejection).
- Richard Durstenfeld. Algorithm 235: Random permutation. Communications of the ACM 7(7), 1964.
- Donald E. Knuth. The Art of Computer Programming, Volume 2: Seminumerical Algorithms (3rd ed.), §3.4.2. Addison-Wesley, 1997.
Reviewed 30 November 2026.