Random Number

One uniformly chosen integer in an inclusive range is the primitive behind raffles, sampling, and test IDs. This page uses rejection sampling on CSPRNG bytes so large ranges are not biased the way a naive modulo is. Ask for one number when you need one number, not a statistical sample.

What the random number generator is for

Picking a number in a range comes up constantly — choosing a winner, sampling data, or assigning something at random. Doing it in your head is not random at all; people avoid extremes and favour certain digits.

Cryptographic randomness matters whenever the outcome could be disputed or has value attached.

Common uses

  • Drawing a winner from a numbered list of entrants
  • Selecting a random sample for a quality check
  • Choosing a random index or test value

What the output means in the real world

The integer is the selection. If it represents a winner or a sample row, record the range and the result in the same note. Generating again is a new draw, not a confirmation. Do not use a small range as an OTP or a password.

How this fits into real work

JavaScript's Math.random() * n | 0 is biased and predictable. Security-sensitive draws (who gets a production token) must not use it. This page does not use it.

Inclusive bounds matter. A '1 to 10' raffle that is actually 0-9 in code is how you get a fistfight at a meetup. Read the labels before you announce a winner.

For many numbers with a histogram or a CSV export, use the random-number generator page. This one exists to produce a single fair draw you can announce once.

How to use this tool

  1. Set the minimum and maximum values, both inclusive.
  2. Generate and read the result.
  3. Repeat as needed — each draw is independent, so values can repeat.

Tips

  • For a draw where numbers must not repeat, generate a list and remove each one as it is used.
  • Record the range and result if the outcome needs to be auditable later.

Privacy & how it works

Everything happens inside your browser. The values you type are held in page memory only, are never sent to a server, and disappear when you close the tab. You can confirm this in your browser's network tab: the only request a tool makes is one that names the tool for a usage count, with nothing you typed in it. The tools also work with the internet disconnected. Randomness comes from crypto.getRandomValues(), the browser's cryptographically secure generator, not Math.random(). Math.random() is seeded predictably and must never be used for anything security-related, because an attacker who learns part of the sequence can reconstruct the rest.

Frequently asked questions

Can the same number come up twice?
Yes. Each draw is independent, so repeats are expected — that is what randomness looks like. Use a shuffled list if you need values without replacement.

Browse other tools

All tools run entirely in your browser — nothing you type is sent to a server, except the optional HIBP 5-character hash prefix.