Skip to content
CalcSpectrum

Random Number Generator

Generate one or more cryptographically secure random integers within a minimum/maximum range, with or without duplicates.

Free to use · Instant results
Loading calculator…

How It's Calculated

Formula

n_i \sim \text{Uniform}\{\text{min}, \dots, \text{max}\}

This generator draws each integer independently and uniformly from the inclusive [minimum, maximum] range, using the browser's cryptographically secure random number generator (Web Crypto's crypto.getRandomValues) with unbiased rejection sampling — never Math.random. With duplicates allowed, each number is drawn independently, so the same value can appear more than once. With duplicates disabled, numbers are drawn without replacement (a virtual partial Fisher-Yates selection), so quantity cannot exceed the number of distinct integers in the range. This version generates whole numbers only.

Worked Examples

5 unique numbers between 1 and 49 (e.g. a lottery-style draw)

  1. Set minimum = 1, maximum = 49, quantity = 5, allow duplicates = off.
  2. Click Generate Numbers.
  3. 5 distinct integers are drawn without replacement from {1, ..., 49}.

Frequently Asked Questions

Can I generate decimal or floating-point random numbers?

Not in this version. This generator currently produces whole (integer) numbers only.

What happens if I disable duplicates and ask for too many numbers?

Generation is rejected if the requested quantity exceeds the number of distinct integers available in [minimum, maximum] — for example, asking for 10 unique numbers between 1 and 5 is impossible.

Does changing the range reroll my results?

No. Numbers are generated only when you click "Generate Numbers." Changing the range, quantity, or duplicates setting afterward does not change the displayed numbers until you click the button again.