Cryptographically Secure Random Number Generator
Draw numbers from the Web Crypto entropy source, with no bias from rounding or modulo.
Secure Random Number Generator
Number from 1 to 100
Range
How many numbers
How to use the secure random generator
- Set the range and how many numbers you need.
- Turn on no repeats for a unique set, and sort if you want it ordered.
- Generate, then copy or export.
What is a secure random number generator
A secure random number generator draws numbers from the Web Crypto entropy source in your browser, with no bias from rounding or modulo. Set your range and count, and Random Nr uses rejection sampling on cryptographic randomness so every value is equally likely, which is what security codes, tokens and serious draws should be built on.
Why Math.random is not enough
Everyday scripting randomness and cryptographic randomness are different tools. The common Math.random is fine for shuffling a playlist and wrong for anything security sensitive.
| Property | Math.random | Web Crypto (this tool) |
|---|---|---|
| Unpredictable | no, state can be recovered | yes |
| Seeded from hardware entropy | no | yes |
| Safe for keys and tokens | no | yes |
| Free of modulo bias here | not handled | handled by rejection sampling |
Math.random uses a fast pseudo random algorithm whose internal state can be reconstructed from a few outputs, which means future values can be predicted. This tool uses the Web Crypto source instead, the same one used to generate encryption keys.
What is modulo bias
A naive way to fit a random value into a range is to take it modulo the range size, but unless the range divides evenly into the source, some numbers come up slightly more often than others. Over a key or a token, that skew is a real weakness. This generator uses rejection sampling: it discards the rare values that would cause the skew and draws again, so every number in the range is exactly equally likely.
What a secure generator is used for
This tool produces the secure random numbers behind passwords, tokens and keys. It does not assemble a full password with letters and symbols, which needs its own length and character rules. For the same source framed around physical entropy, see the true random number generator.
More number generators
Frequently asked questions
What makes it secure
It draws from the Web Crypto entropy source, which is designed to be unpredictable enough for security keys, and it avoids modulo bias with rejection sampling.
What is modulo bias
When a range does not divide evenly into the random source, a simple remainder favours some numbers. Rejection sampling removes that bias.
Can I draw a unique set
Yes. Tick no repeats for distinct numbers, capped at the size of the range.
Is it suitable for passwords
It is suitable for the random numbers behind them. For full passwords, use a dedicated password tool that also handles characters and length rules.
Is it free
Yes, free and with no sign up.
Related generators
- Number Base Converter
- Random Binary Number Generator
- Random Hex Number Generator
- Random Octal Number Generator
- Random Roman Numeral Generator
- True Random Number Generator
- Secure Random Number Generator
- Normal Distribution Generator
- Random Sample Generator
- Random Combination Generator
- Permutation Generator
- Random Number Generator
For the same source framed around entropy, see the true random number generator.