Random Number Generator

MATH · PROBABILITY & SAMPLING

Configure your random draw

Calculated on this device
Inclusive lower bound for generated numbers.
Inclusive upper bound for generated numbers.
Whole number between 1 and 1,000.
Sorting options
Choose whether to keep draw order or sort ascending or descending.

READY

Click “Generate numbers” to draw values on this device.

HOW IT WORKS

Unbiased random sampling with crypto.getRandomValues

Standard Math.random() implementations are not guaranteed to be cryptographically uniform and naive modulo reduction introduces bias when the range does not divide 2³² evenly. This generator uses your browser's Web Crypto API.

01

Rejection sampling for integers

Each 32-bit unsigned integer from crypto.getRandomValues is rejected if it falls in the partial remainder bucket above the largest multiple of the range width, ensuring every integer has an identical probability.

P(X = k) = 1 ÷ (max − min + 1)
02

Unique draws without replacement

When “Allow duplicates” is unchecked, the generator uses a partial Fisher–Yates shuffle (or hash-set tracking for wide ranges) so no number repeats.

03

53-bit uniform decimals

Decimal mode combines two 32-bit draws into a 53-bit IEEE-754 mantissa in [0, 1), scales it to [min, max], and rounds to your chosen decimal precision.

SAMPLING GUIDE

When to use integer vs. decimal draws and replacement settings

With replacement vs. without replacement

Keep Allow duplicates checked when simulating independent events like rolling a six-sided die multiple times. Uncheck it when selecting raffle winners, assigning participants to experimental groups, or picking non-repeating lottery numbers. To analyze the spread of a generated sample, paste the list into our Standard Deviation Calculator.

Frequently asked questions

Are both the lower and upper limits inclusive?

Yes. Both the lower limit and upper limit can appear in the generated output. If you set min = 1 and max = 6, the generator draws from {1, 2, 3, 4, 5, 6}.

Why does it use crypto.getRandomValues instead of Math.random()?

crypto.getRandomValues draws from your operating system's cryptographically secure random number generator (CSPRNG), avoiding predictable PRNG sequences and modulo bias.

Why do I get an error when generating unique numbers in a small range?

If “Allow duplicates” is off, you cannot draw more unique integers than exist between min and max. For example, between 1 and 5 there are only 5 unique integers.

Does sorting change the randomness of the draw?

No. Numbers are drawn independently first and only sorted afterward for easier inspection.

Random numbers are generated locally in your browser and are never transmitted to a server.