Random Number Generator
Draw random numbers in any range, with cryptographic randomness, not Math.random().
Set a range and press Generate.
Features
- Any integer or decimal range
- Draw with or without replacement
- Up to 10,000 numbers at once
- Summary statistics for the draw
- Cryptographically secure, uniformly distributed
How to use it
- Set the minimum and maximum.
- Choose how many numbers you need.
- Turn on no-repeats for lottery-style draws.
- Press Generate.
Why the source of randomness matters
JavaScript's Math.random() is a pseudo-random generator seeded from an internal state. It is fast and statistically fine for animations or shuffling a playlist, but it is not unpredictable: given enough consecutive outputs, its internal state can be recovered and all future values predicted. That makes it unsuitable for anything where someone benefits from guessing the result, prize draws, tokens, passwords, or shuffling cards for money.
This tool uses crypto.getRandomValues(), which draws from the operating system's cryptographically secure entropy pool. Predicting its output requires breaking the underlying CSPRNG, not merely observing previous values.
There is a second, subtler trap. The obvious way to map a random integer into a range is value % range, but unless the range divides evenly into the generator's output space, the lower values in the range come up slightly more often. For a small range the bias is tiny; for a large one it can be several percent. This tool uses rejection sampling, discarding and redrawing values that fall in the uneven tail, which makes the distribution exactly uniform at the cost of an occasional extra draw.
Frequently asked questions
Related tools
Further reading
Read the full guide on the 123MiniApps blog.