Skip to content
PercentPoint

Random Number Generator

Pick one random number or a whole list between any two values. Choose whole numbers or decimals, allow or block repeats, and sort the results. Every value in the range has the same chance, and the numbers are generated in your browser, not on a server.

For planning only. Your school, syllabus or accountant has the final word. First published · Last reviewed by PercentPoint.

How to use the random number generator

  1. Choose whole numbers or decimals. Whole numbers include both ends of the range: 1 to 10 can give 1 or 10. Decimals run from the minimum up to, but not including, the maximum.
  2. Set the range and how many. Enter the minimum, the maximum and how many numbers you want, up to 10,000.
  3. Decide about repeats. With “No repeats” on, each number can appear only once, like names drawn from a hat. Turn it off for independent draws, like rolling a die several times.
  4. Press Generate. Press it again for a fresh draw. Turn on “Sort the results” to list them from smallest to largest.

The quick picks set up common draws: a die roll (1 to 6), a number from 1 to 10, three different numbers from 1 to 30, or a coin flip as 0 or 1.

What makes a draw fair

A fair generator gives every allowed value the same probability, and each draw is independent of the others. For a range of 1 to 100, each number has a 1 in 100 chance on every draw, regardless of what came before. A run of repeated or nearby numbers is not a sign of a problem; in truly random draws, streaks happen more often than intuition suggests.

For a whole-number range from min to max, there are max − min + 1 possible values. The probability of any one value is 1 ÷ (max − min + 1), and the expected average of many draws is (min + max) ÷ 2. The “Average” card compares your draws with that expectation; with more numbers, the two move closer, as the law of large numbers predicts.

Where the randomness comes from

The numbers come from the Web Crypto API’s getRandomValues() method, built into every modern browser. MDN, Mozilla’s reference for web developers, describes it as providing cryptographically strong random values: a pseudo-random generator seeded with enough entropy, suitable for cryptographic purposes. NIST’s SP 800-90A sets out recommended designs for that kind of generator.

This is different from Math.random(), the quick generator many web pages use, which is not designed to resist prediction. For picking a winner or assigning people to groups, a cryptographic source is the safer choice.

Everything runs on your device. The page doesn’t send your range or your results anywhere, and refreshing it doesn’t save previous draws.

Avoiding modulo bias

A random source produces raw bits, typically 32 at a time: a whole number from 0 to 4,294,967,295. The obvious way to turn that into a number from 1 to 6 is to take the remainder after dividing by 6 and add 1. But 4,294,967,296 isn’t a multiple of 6. It leaves a remainder of 4, so four of the six outcomes would get one extra chance out of about 4.3 billion.

That bias is tiny for a die but grows with the range. With a range of 3 billion, the remainder trick would make the lowest 1.3 billion values twice as likely as the rest. The calculator uses rejection sampling instead: it discards any raw value at or above the largest multiple of the range and draws again. Every remaining value maps to exactly the same number of outcomes, so the result is exactly uniform. Ranges larger than about 4.3 billion combine two raw values.

Draws without repeats

With “No repeats” on, the calculator draws without replacement. For ranges up to 100,000 it shuffles the whole range with the Fisher–Yates method, stopping after as many numbers as you asked for, which keeps every possible set of results equally likely. For larger ranges it draws and skips any number it has already used.

You can’t draw more unique numbers than the range holds: 6 different numbers from 1 to 5 is impossible, and the calculator says so. Drawing every number in the range with “No repeats” on gives a random ordering of the whole range, useful for a presentation order or a seating chart.

The number of possible unique draws grows quickly. Choosing 3 different numbers from 1 to 30 can give C(30, 3) = 4,060 different sets, or 24,360 different ordered lists; the permutation and combination calculator explains the difference.

Random decimals

In decimal mode, choose how many decimal places you want, from 0 to 10. The generator picks uniformly among all the values with that many places from the minimum up to just below the maximum: from 0 to 1 with 2 places, that is 0.00, 0.01, … 0.99, each with a 1 in 100 chance. Results keep trailing zeros, such as 0.50, so every result has the same number of places.

Common uses

  • Classroom and games: calling on students, choosing teams, rolling dice when none are at hand.
  • Sampling: picking which survey responses, invoices or items to check, so the choice isn’t influenced by the person choosing.
  • Experiments: randomly assigning participants to groups, which helps make the groups comparable.
  • Giveaways: numbering entries and drawing a winner. For prize drawings with legal requirements, follow the official rules that govern them.

How often repeats turn up

With “No repeats” off, repeated numbers appear more often than most people expect. Drawing 10 numbers from 1 to 100, the chance that at least two match is about 37%. Drawing 23 numbers from 1 to 365, it is about 51%; that is the classic birthday problem, in which 23 people give better-than-even odds that two share a birthday.

The calculation multiplies the chances that each new draw misses every earlier one: for 10 draws from 100, (100 × 99 × … × 91) ÷ 100¹⁰ ≈ 0.63, so a repeat has a 1 − 0.63 ≈ 37% chance. If repeats would spoil your draw, such as picking 10 different winners, switch “No repeats” on.

Checking the results yourself

A good way to see uniformity is to generate many numbers and compare their summary with theory. Roll a die 10,000 times by setting 1 to 6 and “How many” to 10,000. The average should come out close to 3.5, the midpoint of 1 and 6, and the sum close to 35,000. Each face should appear roughly 1,667 times, give or take a few dozen.

The spread of a single die roll has a standard deviation of √(35 ÷ 12) ≈ 1.71, so averages of 10,000 rolls typically land within about ±0.03 of 3.5. Larger gaps on repeated tries would suggest a problem; small ones are ordinary chance. The probability and expected value calculators explain these ideas in more detail.

Sources & assumptions

How this calculator gets its numbers. Full method: our methodology.

  • Random words come from the browser’s crypto.getRandomValues(); nothing is sent to a server.
  • Whole numbers use rejection sampling so every value from the minimum to the maximum (inclusive) is equally likely.
  • “No repeats” draws without replacement; decimals are uniform from the minimum up to, but not including, the maximum.

Sources

  1. MDN Web Docs (Mozilla), Crypto: getRandomValues() method. The browser API that fills an array with cryptographically strong random values.
  2. National Institute of Standards and Technology, SP 800-90A Rev. 1, Recommendation for Random Number Generation Using Deterministic Random Bit Generators. NIST’s recommendation for deterministic random bit generators: pseudo-random generators seeded with enough entropy for cryptographic use.

Last reviewed . For drawings with legal or financial stakes, follow the rules that govern them.

Frequently asked questions

Is this random number generator truly random?

It uses the browser’s cryptographic random source, a pseudo-random generator seeded with real entropy. Its output can’t be predicted in practice and is suitable for cryptographic use.

Does the range include the maximum?

For whole numbers, yes: both the minimum and the maximum can be drawn. For decimals, the maximum itself is excluded.

How do I pick numbers without repeats?

Turn on “No repeats”. Each number then appears at most once, as in drawing names from a hat.

What are the odds of getting a particular number?

For whole numbers, 1 ÷ (max − min + 1) on each draw. From 1 to 100, that is 1%.

Can I generate a random number between 1 and 10?

Yes. Set the minimum to 1 and the maximum to 10, or use the “1 to 10” quick pick, then press Generate.

Are my results saved or shared?

No. The numbers are created on your device, and nothing is sent to a server.