Skip to content
ΣCalcYeti

Random Number Generator

Generate up to 100 secure random integers in an inclusive range, with optional duplicate prevention.

Content updated August 1, 2026

Generation status
Ready
Choose a range, then generate
Available values
100
Duplicates
Allowed

Uses the browser Web Crypto random source and rejection sampling to avoid modulo bias. The maximum selectable range contains 2³² integers.

Generate one or many integers between an inclusive minimum and maximum. You can allow repeated values or request a unique sample without constructing the entire range in memory.

The generator uses the browser's Web Crypto source rather than Math.random. It maps unsigned 32-bit values into the selected range with rejection sampling so an uneven modulo remainder does not make some results more likely than others.

The Random Number Generator formula

r = min + (u mod N), only when u < floor(2³² ÷ N) × N

N = max − min + 1 possible integers · u = an unsigned 32-bit Web Crypto value · rejected tail values are redrawn.

Worked example

For the inclusive range 10 through 14, N = 5. Each accepted unsigned 32-bit source value maps to exactly one of the five integers; requesting unique values samples without replacement.

Assumptions, rounding, and limitations

Assumptions

  • Minimum and maximum are safe whole numbers and both endpoints are included.
  • The browser provides the Web Crypto getRandomValues method.
  • Disabling duplicates means sampling without replacement.

Rounding: No numeric rounding is performed because every input and output is an integer.

Limitations

  • Generates at most 100 values per action from a range containing no more than 2³² integers.
  • Results are not seeded, reproducible, saved, or suitable for generating cryptographic keys.

Sources

How unbiased range mapping works

A 32-bit source has 4,294,967,296 possible values. When that total is not evenly divisible by the selected range size, directly taking a remainder would give a few outcomes one extra source value.

Rejection sampling discards the small incomplete tail before applying the remainder. For no-duplicate results, a partial Fisher–Yates shuffle samples unique offsets without allocating billions of entries.

Frequently asked questions

Are the minimum and maximum included?

Yes. Both endpoints are eligible, so a range from 1 through 100 contains exactly 100 possible integers.

Can I prevent duplicate numbers?

Yes. Turn off Allow repeated values. The requested count then cannot exceed the number of integers in the range.

Why not use Math.random?

This tool uses the browser Web Crypto getRandomValues method, which the W3C specification defines for cryptographically strong random values.

Can I reproduce the same sequence later?

No. This generator has no seed input and does not save results. Record the generated numbers yourself if you need them later.

Related calculators

Disclaimer: Random Number Generator results are estimates for general information and education only, and are not financial, tax, legal or medical advice. Verify important decisions with a qualified professional.