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.
| Source | How it works | Trust | Typical use |
|---|---|---|---|
| Math.random() | Pseudo-random from a seed | Not for anything where prediction matters | Games, simulations, shuffling a playlist |
| crypto.getRandomValues() (used here) | Cryptographically secure; seeded from OS entropy | Suitable for draws, raffles, tokens | Anything fair or security-sensitive |
| Hardware generator | Samples physical noise directly | Highest assurance | Key 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.
| Use | Range | Chance of a given value |
|---|---|---|
| Coin flip | 0 to 1 | 50% |
| Six-sided die | 1 to 6 | 16.67% |
| Twenty-sided die | 1 to 20 | 5% |
| Percentile | 1 to 100 | 1% |
| Lottery ball, 1 of 49 | 1 to 49 | 2.04% |
| Raffle with 500 tickets | 1 to 500 | 0.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.
| Total | Ways | Probability |
|---|---|---|
| 2 | 1/36 | 2.78% |
| 3 | 2/36 | 5.56% |
| 4 | 3/36 | 8.33% |
| 5 | 4/36 | 11.11% |
| 6 | 5/36 | 13.89% |
| 7 | 6/36 | 16.67% |
| 8 | 5/36 | 13.89% |
| 9 | 4/36 | 11.11% |
| 10 | 3/36 | 8.33% |
| 11 | 2/36 | 5.56% |
| 12 | 1/36 | 2.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.
| Game | Main numbers | Bonus numbers | Jackpot odds |
|---|---|---|---|
| Powerball | 5 of 1–69 | 1 of 1–26 | 1 in C(69, 5) × 26 = 292,201,338 |
| Mega Millions | 5 of 1–70 | 1 of 1–24 | 1 in C(70, 5) × 24 = 290,472,336 |
| Lotto 6/49 | 6 of 1–49 | none picked | 1 in C(49, 6) = 13,983,816 |
| EuroMillions | 5 of 1–50 | 2 of 1–12 | 1 in C(50, 5) × C(12, 2) = 139,838,160 |