Random Number Generator
Inclusive integer range. Sampling uses crypto.getRandomValues with rejection so the result is not biased by modulo.
Rated 4.8 out of 5 based on 940 reviews
How to generate random integers
- Set the inclusive minimum and maximum.
- Set how many numbers to draw.
- Turn Unique on for sampling without replacement.
- Generate. This is a CSPRNG in the browser, not a hardware entropy source you can certify.
Random integer
Unbiased integers from Web Crypto
| Source | crypto.getRandomValues |
|---|---|
| Bias | Rejection sampling, not value % n |
| Unique | Draw without replacement |
| Not | Atmospheric noise or a lab TRNG |
Uniform integers
Each integer from minimum through maximum inclusive is equally likely. Draws use Web Crypto (rejection sampling), not Math.random. Count may be up to 1000. Unique draws cannot exceed the size of the range.
With and without replacement
Unique is on by default: a sample without replacement, like drawing raffle tickets. Turn unique off to allow repeats. For names instead of numbers, use the list picker or spin the wheel.
Not a lottery or crypto key
This is a fair integer generator for lists and games. It is not a national lottery draw and not a way to generate encryption keys. Passwords have their own page: password generator.