Random Number Generator
Generate random numbers in any range, with or without duplicates, using the browser's cryptographic random source.
Last reviewed by the Radiatus Cloud team
?
Need this done properly for your business?
Radiatus delivers secure cloud, DevOps & compliance engineering.
Two kinds of random, and the difference matters
A pseudo-random generator produces a deterministic sequence from a seed. It is fast, repeatable and completely adequate for a game, a simulation or shuffling a playlist. A cryptographically secure generator produces output that cannot be predicted even given everything before it, which is what you need for anything where someone benefits from guessing: a prize draw, a token, a password. This tool uses the browser's crypto source, so it is safe for both.
Modulo bias
The obvious way to force a random number into a range is to take the remainder after dividing. That skews the result: if the generator produces 0 to 255 and you want 1 to 10, the values 1 to 6 come up slightly more often than 7 to 10, because 256 does not divide evenly. The bias is small and completely real, and the fix is rejection sampling, discarding values that fall outside a clean multiple of the range. Any generator used for a draw should do this.
With or without duplicates
Drawing a lottery is sampling without replacement: each number appears once. Rolling dice repeatedly is sampling with replacement, where repeats are expected. Choosing the wrong mode is the most common error, and the symptom is a lottery draw that produces the same number twice, which invalidates it.
Random does not mean evenly spread
Genuine randomness clumps. In a hundred coin flips, a run of six heads is more likely than not, and people reading that run assume the generator is broken. Sequences that look evenly distributed are usually the ones that have been tampered with. Expect clustering, and do not correct for it.
Verifiability for prize draws
For anything where a participant might dispute the result, a random number alone is not enough: nobody can check it. Provable-fairness approaches publish a commitment to a seed before the draw and reveal it after, so the outcome can be verified independently. If the draw matters, the audit trail matters more than the entropy source.
Related tools
- Data Collection Analysis — Analyze app description to infer data collection.
- Dark Pattern Detector — Scan UX text for manipulative patterns.
- AI Risk Disclosure — Generate disclosure text for AI features.
- Maturity Radar — Generate a radar chart of security maturity.
Frequently Asked Questions
Is this random enough for a prize draw?
The generator is, since it uses the browser's cryptographic source with unbiased range sampling. Whether the draw is defensible is a separate question: for a disputable result, publish a seed commitment beforehand so participants can verify.
What is modulo bias?
The skew from forcing random values into a range with a remainder operation. If the source gives 0 to 255 and you want 1 to 10, low values appear slightly more often, because 256 is not a multiple of 10.
Should I allow duplicates?
Depends on the draw. Lottery-style selection is without replacement, so each number appears once. Dice rolls are with replacement, where repeats are expected. Picking the wrong mode invalidates a draw.
Why did I get the same number several times?
Either duplicates are enabled, or you are seeing normal clustering. Genuine randomness clumps: a run of six heads in a hundred flips is more likely than not. Evenly spread sequences are the suspicious ones.
Is Math.random good enough?
For games and simulations, yes. For anything where someone benefits from predicting the output, no: its state can be reconstructed from enough output. Use a cryptographic source for draws and tokens.
Privacy & Security
Generated locally in browser.
About This Tool
This tool runs entirely in your browser. No data is sent to any server, ensuring complete privacy. Simply use the interface above to get started β no registration or login required.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.