Random Number Generator

Generate one or many random numbers between any range — unique or repeating, sorted or shuffled, free and unbiased.

Settings

Up to 1,000 at a time.

Results

0
Count
0
Sum
0
Average
0
Lowest
0
Highest

How This Random Number Generator Works

This tool generates whole numbers within a range you choose, using the browser's Web Crypto API (crypto.getRandomValues()) instead of the more commonly used Math.random(). The Crypto API draws from your operating system's cryptographically secure random source, which is both harder to predict and more suitable for fairness-sensitive uses like raffles, dice rolls, or drawing lottery numbers.

Why a naive random range calculation is biased

A common shortcut for turning a random number into a range is to take the remainder after dividing by the range size (random % range). That approach is subtly biased: unless the range divides evenly into the generator's total output space, some remainders come up slightly more often than others — an effect called modulo bias. It's small for a narrow range like 1-6, but grows for wider or awkward ranges.

How this tool avoids that bias

Instead of taking the remainder directly, this generator uses rejection sampling: it computes the largest multiple of your range size that fits inside the generator's output space, and simply throws away and re-draws any random value that falls in the small leftover portion above that multiple. What remains is mapped onto your range with the remainder operation, but now every value in the range has exactly equal probability, with no leftover bias.

How to use it, step by step

  1. Enter a Minimum and Maximum — negative numbers are allowed.
  2. Enter how many numbers you want (up to 1,000).
  3. Optionally list numbers to exclude, and tick "No duplicate numbers" or "Sort results" as needed.
  4. Click Generate. Copy the comma-separated list with the Copy button if you want to save it — nothing is stored automatically.

Unique numbers and range limits

When "No duplicate numbers" is ticked, the pool of possible values is your range minus any excluded numbers, and you can never draw more unique numbers than that pool contains. If you ask for more than the pool allows, the tool tells you instead of silently generating fewer numbers than requested.

Frequently Asked Questions

It uses the Web Crypto API's crypto.getRandomValues(), not the more common Math.random(). That function draws from your operating system's cryptographically secure random source, and this tool applies rejection sampling on top of it so every number in your chosen range has exactly equal odds, with no bias toward smaller or larger values.

Yes — that's exactly the kind of use this tool is built for. Because it draws from a cryptographically secure source with rejection sampling to avoid bias, it's genuinely unpredictable and uniform across your range, which is what you want for a fair draw, a dice simulation, or picking numbers for a lottery ticket.

Without duplicates, each number can only appear once, so you can never generate more unique numbers than exist in your range (after removing any excluded numbers). For example, a range of 1 to 10 can produce at most 10 unique numbers — asking for 15 unique numbers from that range is bound to fail, and the tool tells you so instead of silently generating fewer than you asked for.

A naive way to generate a random number in a range is to take a random 32-bit integer and use the remainder after dividing by the range size (the modulo operation). That silently favors smaller numbers whenever the range doesn't divide evenly into 2^32, a problem called modulo bias. This tool avoids it with rejection sampling: it discards any random value that would fall in the leftover, unevenly-sized portion and draws again, so every number in your range keeps exactly equal probability.

Negative numbers are fully supported — set a negative minimum, such as -50 to 50. Decimals are not: this tool generates whole numbers (integers) only.

Yes, up to 1,000 numbers per generation. That cap exists purely to keep the page responsive when rendering results — it has nothing to do with randomness quality, which is identical whether you generate 1 number or 1,000.

No. Every click of Generate draws fresh values from your browser's secure random source, with no seed or history to reproduce a past result. If you need to save a set, copy it with the Copy button before generating again.