Random Number Generator
Generate random numbers in any range, with or without duplicates, using a cryptographic source.
Formula
crypto.getRandomValues with rejection sampling to avoid modulo bias
Tips
- Numbers come from the browser’s cryptographic random source, not Math.random, and use rejection sampling so every value in the range is equally likely.
- Naive generators take a random number modulo the range, which quietly favours the lower values. This one does not.
- Turn duplicates off for lottery-style draws or picking winners; leave them on for dice-style rolls.
Frequently asked questions
Is this random enough for a prize draw?
The randomness is sound. Whether a draw is *fair* is a separate question about process — who ran it, whether it can be re-run, and whether anyone can verify it. For anything with legal weight, use a documented procedure with witnesses.