Random Number Generator
Generate one or more random integers or decimals within a custom range.
Distribution of generated values
How It Works
The Random Number Generator produces uniformly distributed random integers (or decimals) in any range you choose, drawn from your browser’s crypto.getRandomValues — the cryptographically secure random source. Set a minimum and maximum, choose how many numbers to generate (from one to a few thousand), and pick whether to allow repeated values. The generator uses rejection sampling rather than naive modulo arithmetic, so the output distribution is exactly uniform across the range — every integer between min and max inclusive is equally likely, with no bias toward smaller numbers (which the modulo trap introduces when the range size does not divide the random source’s size evenly). For decimal mode, the tool produces a uniform float in the requested range with the precision you specify. Without-replacement mode shuffles a Fisher-Yates permutation when you ask for many distinct values from a small range, falling back to rejection sampling for sparse picks. Generation is instant and runs entirely client-side, with no input sent over the network.
Use Cases
- Generating random numbers for statistical sampling
- Picking lottery numbers or raffle tickets
- Creating random test data within a known range
- Simulating dice rolls or other random events in a game
Frequently Asked Questions
- Is the distribution exactly uniform?
- Yes. Rejection sampling avoids the modulo bias that naive (random % n) introduces, so every integer in the range is equally likely.
- Why use this instead of Math.random?
- Math.random is a non-cryptographic PRNG that may be seeded predictably and is not appropriate when fairness or unguessability matters. crypto.getRandomValues is the secure equivalent.
- What if I ask for unique numbers and the range is too small?
- The tool rejects requests where you ask for more unique numbers than the range can supply (e.g. 100 unique numbers in 1–10 is impossible).
- Can I generate decimals?
- Yes. Set the precision (number of decimal places) and the tool produces uniform floats in the range.
- Are my numbers sent anywhere?
- No. Everything happens in your browser; the generated numbers are discarded on tab close.