Random Number Generator

Generate random numbers in any range, with or without repeats, or draw several sorted lottery-style tickets with a bonus-ball pool, from your browser's secure source.

Generator

The smallest number that can come up.

The largest number that can come up.

Up to 1,000 at a time.

Random number

—

Set a range and press Generate. Numbers are drawn with the browser's cryptographic random source.

Random numbers in simple words

A random number is one you cannot guess ahead of time. Every number in the range has the same chance of coming up, like drawing a numbered ball from a bag without looking.

If you pick from 1 to 10, there are 10 numbers, so each one has a 1 in 10 chance (10%) on every draw. Getting 7 once does not make 7 more or less likely next time.

With “no repeats” on, each number drawn is set aside, like keeping the ball out of the bag. That is useful for raffles or picking teams, where nobody should be picked twice.

A lottery ticket works the same way, but the numbers are sorted and the odds of matching them all are very small. Choosing 5 numbers from 1 to 69 can be done 11,238,513 ways, and only one of them wins.

How the numbers are generated

This generator uses the Web Crypto API's getRandomValues, which draws from the operating system's cryptographically secure entropy pool rather than a simple arithmetic pseudo-random sequence. That makes the output suitable for draws, raffles, and sampling where predictability would be a problem.

It also applies rejection sampling to avoid modulo bias. Naively taking a random 32-bit integer modulo the range size makes some outcomes slightly more likely than others, because the total number of 32-bit values usually is not an exact multiple of the range. Discarding the small remainder region before taking the modulo restores an exactly uniform distribution.

Three kinds of random source
SourceHow it worksTrustTypical use
Math.random()Pseudo-random from a seedNot for anything where prediction mattersGames, simulations, shuffling a playlist
crypto.getRandomValues() (used here)Cryptographically secure; seeded from OS entropySuitable for draws, raffles, tokensAnything fair or security-sensitive
Hardware generatorSamples physical noise directlyHighest assuranceKey generation, gambling machines

True randomness versus pseudo-randomness

A pseudo-random generator produces a deterministic sequence from a starting seed. Knowing the seed and the algorithm lets you reproduce the entire sequence, which is valuable for reproducible simulations and unacceptable for anything security-sensitive. JavaScript's Math.random is such a generator and offers no guarantees about quality across browsers.

Cryptographically secure generators, like the one used here, are seeded from unpredictable physical sources such as hardware timing jitter and are designed so that observing past output does not reveal future output. Hardware generators go further, sampling physical processes like thermal noise or radioactive decay directly.

Ranges for common uses

Set the range to match what you are simulating. Every value in the range is equally likely, so the chance of any particular result is one divided by the size of the range.

Common ranges and the chance of any one value
UseRangeChance of a given value
Coin flip0 to 150%
Six-sided die1 to 616.67%
Twenty-sided die1 to 205%
Percentile1 to 1001%
Lottery ball, 1 of 491 to 492.04%
Raffle with 500 tickets1 to 5000.2%

Two dice are not uniform

One die gives every face the same chance; the sum of two does not, because there are more ways to make a 7 than a 2. To simulate two dice, generate two numbers from 1 to 6 and add them rather than one number from 2 to 12 — the second approach gets the probabilities wrong.

Probability of each total on two six-sided dice
TotalWaysProbability
21/362.78%
32/365.56%
43/368.33%
54/3611.11%
65/3613.89%
76/3616.67%
85/3613.89%
94/3611.11%
103/368.33%
112/365.56%
121/362.78%

Common uses and the no-repeat option

With repeats allowed, each draw is independent — the same number can appear more than once, exactly like rolling a die repeatedly. This is what you want for simulating independent trials.

With no repeats, the result is a random sample without replacement, which is what a raffle or lottery draw needs: once a number is picked, it cannot be picked again. This mode requires the range to be at least as large as the count, since you cannot draw ten unique values from a range of five.

Lottery presets

In Lottery tickets mode (also at #lottery), the Game menu fills in the pools for four games. The matrices were checked against official lottery sites in September 2026, and each site's published jackpot odds equal C(main pool, picks) × C(bonus pool, bonus picks). Games change their rules from time to time, so check the official site before you play.

Random tickets are as likely to win as any other numbers. They do not predict draws or improve the odds.

Preset matrices and the jackpot odds for one ticket
GameMain numbersBonus numbersJackpot odds
Powerball5 of 1–691 of 1–261 in C(69, 5) × 26 = 292,201,338
Mega Millions5 of 1–701 of 1–241 in C(70, 5) × 24 = 290,472,336
Lotto 6/496 of 1–49none picked1 in C(49, 6) = 13,983,816
EuroMillions5 of 1–502 of 1–121 in C(50, 5) × C(12, 2) = 139,838,160

How to generate random numbers

Draw one or many uniformly random whole numbers from any range, with or without repeats.

  1. Set the range

    The lowest and highest values allowed, both inclusive — 1 to 6 for a die, 1 to the number of entries for a raffle.

  2. Choose how many, and whether repeats are allowed

    Allow repeats to simulate independent rolls; forbid them to pick distinct winners.

  3. Generate

    Every value in the range is equally likely. The numbers come from the browser's cryptographic source and are never sent anywhere.

Frequently asked questions

How do I generate lottery numbers?

Choose Lottery tickets, set how many main numbers to pick and from what pool, plus any bonus numbers from a separate pool, and the number of tickets. For 5 of 69 plus 1 of 26, one ticket's chance of matching everything is 1 in C(69, 5) × 26 = 292,201,338. Random picks do not improve those odds.

Are these numbers truly random?

They are cryptographically secure pseudo-random numbers, drawn from your operating system's entropy pool via the Web Crypto API. For any practical purpose — raffles, draws, sampling — they are unpredictable and uniformly distributed. Only specialized hardware generators sample physical randomness directly.

How do I simulate a dice roll or a coin flip?

A coin is a range of 0 to 1; a six-sided die is 1 to 6; a twenty-sided die is 1 to 20. For two dice, generate two numbers from 1 to 6 and add them — a single draw from 2 to 12 would give every total the same chance, which real dice do not.

Can I generate numbers without duplicates?

Yes. Enable the no-repeats option and every generated number will be unique. The range must contain at least as many values as you are requesting, since unique draws cannot exceed the size of the range.

Is this suitable for a raffle or giveaway?

Yes. The cryptographic random source and unbiased sampling make it appropriate for draws. Set the range to cover your entry numbers and enable no-repeats when selecting multiple distinct winners.

Why is modulo bias a problem?

Taking a random 32-bit integer modulo your range size makes lower values slightly more likely whenever the range does not divide evenly into 2³². The bias is small but real. This generator discards values in the uneven remainder region before applying the modulo, which makes the distribution exactly uniform.

References

Last updated . Results are estimates for informational purposes only.