How does a random number generator work?
A random number generator picks an integer between a minimum and maximum value using the browser's cryptographically secure randomness source, so every number in the range has an equal chance of appearing. Example: min 1, max 100, count 5 might return 7, 42, 68, 91, 23.
Steps to generate random numbers
- Set the minimum and maximum bounds of the range you want numbers drawn from.
- Choose how many numbers to generate at once.
- Decide whether repeats are allowed or each number can appear at most once (unique mode).
- Click generate — the tool draws each number using the browser's secure random source.
- Copy the resulting list for use in a raffle, sample, or test data set.
How the range and uniqueness work
Random integer = min + (secure random value mod (max - min + 1))
- min/max = the inclusive range numbers can be drawn from
- unique mode = each number in the range is drawn at most once, like pulling balls from a bag without replacement
Example ranges and typical uses
| Range | Count | Unique | Typical use |
|---|
| 1–6 | 1 | No | Simulating a single die roll |
| 1–45 | 6 | Yes | Lottery-style number set |
| 1–100 | 5 | No | Random sampling with possible repeats |
| 1–10 | 3 | Yes | Quick pick with no duplicates |
| 0–1 | 1 | No | Binary yes/no random pick |
Frequently asked questions
Is this generator truly random or just pseudo-random?
It uses the Web Crypto API's getRandomValues(), a cryptographically secure random number generator built into the browser, suitable for lotteries, giveaways, and other tasks where predictability would be a problem. This is different from the plain Math.random() function, which is faster but not designed for unpredictability.
What does "no repeats" actually do?
With unique mode enabled, once a number is drawn it is removed from the pool before the next draw, similar to picking numbered balls out of a bag without putting them back. This means you cannot request more unique numbers than the range contains.
Can I generate negative numbers?
Yes. Set the minimum to a negative value and the maximum to any value greater than or equal to it; the generator works the same way across negative and positive ranges.
Why did I get the same number twice?
This only happens if unique mode is turned off. With repeats allowed, each draw is independent, so the same number can appear more than once, just as a fairly rolled die can land on the same face twice in a row.
Cryptographic randomness accounts for the number itself; it does not guarantee fairness in how you use the result — for a lottery or raffle, double check that everyone entered has an equal, unique slot in the range you set.
Sources: MDN — Crypto.getRandomValues()