Random Number Generator

Generate random whole numbers in any range. Numbers are drawn with cryptographic randomness and rejection sampling, so every value in the range is genuinely equally likely, which the obvious implementation does not achieve.

Your files never leave this device

Generate random numbers Unbiased ยท Up to 10,000

Inclusive, this number can be drawn.

Inclusive, this number can be drawn.

Up to 10,000 at a time.

How to generate random numbers

  1. Set the minimum and maximum. Both are inclusive.
  2. Choose how many numbers you want.
  3. Tick All different for a draw where nothing repeats, such as a raffle.
  4. Tick sorting if you want them in order rather than as drawn.
  5. Copy the results, comma separated or one per line.

What this generator does

  • Cryptographic randomness rather than the predictable default generator.
  • Rejection sampling, so every number in the range is equally likely.
  • A no-repeats mode using an exact shuffle rather than drawing until something new appears.
  • Up to 10,000 numbers in one go.
  • Comma or line separated output for pasting anywhere.
  • A clear error if you ask for more unique numbers than the range contains.

Two ways to get this subtly wrong

Generating a random number in a range looks trivial and has two well-known traps, both of which produce output that appears random and is not uniform.

The first is modulo bias. Taking a random byte and reducing it modulo 100 seems reasonable, but 256 does not divide evenly by 100, values 0 to 55 can arise from three different bytes while 56 to 99 arise from two. Those first values come up about 50 per cent more often. This generator uses rejection sampling, discarding and redrawing when a value falls outside the largest clean multiple, which removes the bias entirely.

The second is the draw-until-new approach to unique numbers. Asking for 99 unique numbers from 1 to 100 by drawing repeatedly and discarding duplicates works, and the last few draws take an enormous number of attempts. This generator shuffles the range instead, which is exact and finishes in predictable time.

Where the randomness comes from

The browser's cryptographic random number generator draws on the operating system's entropy pool. That matters whenever the outcome is consequential, a prize draw, an allocation, a sample, because the ordinary Math.random is a deterministic algorithm whose future output can be predicted from enough past output.

For picking a number to think of, it makes no difference. For anything anyone might want to game, it makes all the difference.

Common uses

  • Prize draws and raffles, where the no-repeats mode picks distinct ticket numbers.
  • Selecting a random sample of rows from a dataset for checking.
  • Assigning people to groups or an order of presentation.
  • Generating test data with realistic-looking values.
  • Deciding something when nobody can agree.

Randomness does not look random

People consistently reject genuine randomness as suspicious. In a hundred coin flips, a run of six heads is more likely than not, and most people would call it rigged. In a random draw of ten numbers from one to a hundred, two landing within a few of each other is unremarkable, and it looks wrong.

The birthday problem is the sharpest example: with only 23 people there is a better than even chance that two share a birthday. Human intuition about randomness is poor, which is exactly why using a proper generator rather than picking numbers yourself matters, people asked to choose "randomly" avoid repeats and adjacent values, producing something measurably non-random.

What this is not suitable for

Anything requiring auditable fairness. A regulated lottery, a legal ballot, needs a documented, verifiable process, not a web page. The randomness here is cryptographically sound but there is no record, no seed disclosure and no way for a third party to verify what happened.

For random text rather than numbers, the password generator uses the same source, and the text sorter has a shuffle mode for randomising a list you already have.

Frequently asked questions

What is modulo bias?

Taking a random byte modulo 100 makes low values about 50% more likely, because 256 does not divide evenly by 100. This generator uses rejection sampling to eliminate it.

Are the numbers truly random?

They come from the browser's cryptographic generator, which draws on the operating system's entropy pool. That is far stronger than the ordinary Math.random, whose output is predictable.

Why does the no-repeats mode have a limit?

You cannot draw 200 different numbers from a range of 100. The tool says so rather than looping forever, and it shuffles the range rather than drawing until something new turns up.

Why do my random numbers look clustered?

Because genuine randomness clusters. Runs and near-repeats are expected, and their absence is what would be suspicious. Human intuition about randomness is consistently wrong.

Can I use this for an official prize draw?

The randomness is sound, but there is no audit trail or verifiable record. Regulated draws need a documented process rather than a web page.