Skip to main content

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

  1. Set the inclusive minimum and maximum.
  2. Set how many numbers to draw.
  3. Turn Unique on for sampling without replacement.
  4. Generate. This is a CSPRNG in the browser, not a hardware entropy source you can certify.

Random integer

Unbiased integers from Web Crypto

Sourcecrypto.getRandomValues
BiasRejection sampling, not value % n
UniqueDraw without replacement
NotAtmospheric 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.

Random number questions

Does this page upload what I type?
No. The work runs in the page you opened. CZNull does not receive the input.
Is this Math.random?
No. It uses Web Crypto with an unbiased integer method.
Inclusive max?
Yes. Minimum 1 and maximum 6 can roll a 6.
Unique with a range that is too small?
You get an error instead of silent repeats.
Floating point?
Not on this page. Integers only.