# Random Number Generator

Set a range and press Generate: the page picks a whole number between the two ends, both included, and every number in the range is exactly as likely (1 in 100 for 1 to 100; the 42 shown below is a printed example, not a draw). It can also draw several numbers at once with or without repeats, sort them, flip coins and roll dice. Each draw uses your browser’s cryptographic random number generator with rejection sampling, so there is no modulo bias, and nothing is sent anywhere.

Canonical page: https://ponderloop.com/tools/random-number-generator/
Updated: 2026-09-28

## How to use

How to pick a random number

1. **Set the range**: Type the lowest and highest numbers you want, for example 1 and 100. Both ends can come up. Negative numbers work too.
2. **Choose how many**: Leave it at 1 for a single number, or ask for several. Turn on “Allow repeats” if the same number may come up twice, like rolling a die again.
3. **Generate**: Press Generate. Each press is a new, independent draw; earlier results have no effect on the next one.
4. **Share the settings, not the result**: Copy link to these settings sends the range and options. Whoever opens it draws their own number: a link cannot prove what someone else drew.

## Reference tables and worked examples

### The chance of one exact result

Every result of a fair draw is equally likely; this is the chance of any single one. For several different numbers, order is ignored.

| Draw | Chance |
| --- | --- |
| A coin flip | 1 in 2 |
| One six-sided die | 1 in 6 |
| A number from 1 to 10 | 1 in 10 |
| A number from 1 to 100 | 1 in 100 |
| A number from 1 to 1,000 | 1 in 1,000 |
| 3 different numbers from 1 to 10 | 1 in 120 |
| 5 different numbers from 1 to 50 | 1 in 2,118,760 |
| 6 different numbers from 1 to 49 | 1 in 13,983,816 |

### Two dice: the chance of each total

Each die is fair, but totals are not: there are six ways to make 7 and only one to make 2 or 12.

| Total | Ways | Chance |
| --- | --- | --- |
| 2 | 1 of 36 | 2.8% |
| 3 | 2 of 36 | 5.6% |
| 4 | 3 of 36 | 8.3% |
| 5 | 4 of 36 | 11.1% |
| 6 | 5 of 36 | 13.9% |
| 7 | 6 of 36 | 16.7% |
| 8 | 5 of 36 | 13.9% |
| 9 | 4 of 36 | 11.1% |
| 10 | 3 of 36 | 8.3% |
| 11 | 2 of 36 | 5.6% |
| 12 | 1 of 36 | 2.8% |

### Why plain “% n” is unfair, and how often a draw is redone

A random 32-bit word has 4,294,967,296 values. Unless n divides that exactly, “word % n” gives the smallest few results one extra chance. Rejection sampling throws those leftover words away and draws again.

| Range size n | Leftover words | Chance a draw is redone | Bias without rejection |
| --- | --- | --- | --- |
| 2 | 0 | never | none: 2 divides 2^32 exactly |
| 6 | 4 | 1 in 1,073,741,824 | 4 of the 6 results more likely by 1 part in 715,827,882 |
| 10 | 6 | 1 in 715,827,883 | 6 of the 10 results more likely by 1 part in 429,496,729 |
| 100 | 96 | 1 in 44,739,243 | 96 of the 100 results more likely by 1 part in 42,949,672 |
| 1,000 | 296 | 1 in 14,510,025 | 296 of the 1,000 results more likely by 1 part in 4,294,967 |
| 1,000,000 | 967,296 | 1 in 4,440 | 967,296 of the 1,000,000 results more likely by 1 part in 4,294 |
| 3,000,000,000 | 1,294,967,296 | 30.2% | 1,294,967,296 of the 3,000,000,000 results twice as likely as the rest |

## How it works

Every draw starts from crypto.getRandomValues, which fills 32-bit words with random bits from the operating system’s secure generator. To get a whole number from 0 to n − 1, the page takes one word (two for ranges over 2^32, combined into a 53-bit value) and accepts it only if it is below the largest multiple of n that fits; otherwise it draws again. The accepted word modulo n is then exactly uniform, and adding the low end of your range gives the result. Numbers without repeats use Floyd’s sampling algorithm (one draw per number, however large the range) and are then put in random order with a Fisher–Yates shuffle, unless you asked for them sorted. Coins are a draw from two outcomes and dice from 1 to the number of sides. Nothing is precomputed, stored or sent: each press is a fresh draw on your device.

## FAQ

### Is this random number generator really random?

It uses crypto.getRandomValues, the random number generator browsers provide for encryption keys, seeded by your operating system. That is unpredictable in practice, far stronger than the Math.random function most quick tools use. Each number in your range has exactly the same chance, and one draw tells you nothing about the next.

### What is modulo bias, and why does it matter?

A computer produces random bits, not random numbers from 1 to 100. The shortcut is to take a big random number and keep the remainder after dividing by the size of the range, but unless the range divides the number of possible values exactly, the smallest results get slightly more chances. This page throws those leftover values away and draws again (rejection sampling), so the bias is exactly zero. The table above shows how rarely that redraw is needed.

### How do I pick several numbers without repeats, like lottery numbers?

Set the range (1 to 49, say), set How many numbers to 6, leave Allow repeats off and tick Sort smallest first. The numbers are drawn with Floyd’s algorithm, which gives every set of 6 the same chance, 1 in 13,983,816 for 6 from 49. This is for fun and games: it cannot make any lottery ticket more likely to win.

### Why can I share the settings but not the result?

Because a link cannot prove a draw. A link that said “the number was 17” could be typed by anyone, so it would show nothing about what was really drawn. The fair way to settle something is to agree on the settings, then draw once where everyone can see it, for example on a shared screen. The settings link makes that easy; every page that opens it draws its own fresh number.

### Is every number between the two ends possible?

Yes. Both ends are included, so a range from 1 to 10 has ten possible results, each with a 1 in 10 chance. Ranges can be as wide as minus to plus one quadrillion (10^15).

### Are the coin flip and dice fair?

Yes. A coin is a draw from two outcomes and a die a draw from 1 to its number of sides, with the same unbiased method as the numbers. Rolling several dice rolls each one separately, which is why a total of 7 with two dice is far more common than 2 or 12.

### Is anything I draw saved or sent?

No. The numbers are drawn and shown on your device only. The page keeps no history, and analytics (only if you accepted them) record that a button was pressed, never a number or a setting.

## Sources

- [Crypto: getRandomValues() method, MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues)
- [Fisher–Yates shuffle, including the section on modulo bias, Wikipedia](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle)
- [NIST SP 800-90A Rev. 1: Random number generation using deterministic random bit generators](https://csrc.nist.gov/pubs/sp/800/90/a/r1/final)

---

Cite as: Random Number Generator, ponderloop, https://ponderloop.com/tools/random-number-generator/, updated 2026-09-28
