🎲 Random Number Generator
By ToolNimba Editorial Team · Updated 2026-06-19
This random number generator picks whole numbers in any range you choose. Set the minimum and maximum, decide how many numbers you want, and turn duplicates on or off. The numbers are drawn with your browser built-in cryptographic randomness, so every value in the range has an equal chance and the results are genuinely unbiased. Click Generate as many times as you like, then copy the output with one tap. Everything runs in your browser, so nothing you enter is sent anywhere.
What is the Random Number Generator?
A random number generator produces numbers in a way that is hard to predict, with each allowed value equally likely. There are two broad kinds. A pseudo-random generator starts from a seed and runs a formula to produce a long stream of numbers that look random but are fully determined by that seed. A cryptographically secure generator, by contrast, draws entropy from the operating system and is designed so the output cannot be guessed or reproduced. This tool uses the second kind through the Web Crypto API, the same source browsers use for security tasks.
Getting a fair number in a range is less obvious than it looks. The naive trick of taking a big random value and using the remainder after dividing by the range size (the modulo operator) introduces a small bias, because the range rarely divides evenly into the source. The low numbers in the range end up very slightly more likely than the high ones. This tool removes that bias with rejection sampling: it discards the few raw values that fall in the uneven tail and only keeps values from a block that divides cleanly. The result is a uniform distribution where, for example, rolling a number from 1 to 6 gives each face exactly the same chance.
The duplicates toggle changes the method. When duplicates are allowed, each pick is independent, like rolling a die over and over, so the same number can appear more than once. When duplicates are switched off, the tool draws without replacement, like dealing cards from a shuffled deck, so every number comes out at most once. Drawing without replacement is done with a partial Fisher-Yates shuffle, which is the standard unbiased way to pick a unique subset. Because unique mode pulls from a fixed pool, you cannot ask for more numbers than the range contains.
When to use it
- Picking a winner for a giveaway, raffle, or prize draw by assigning everyone a number.
- Rolling dice or generating game values when you do not have physical dice to hand.
- Choosing a random sample of items, rows, or participants for a survey or test.
- Settling a decision fairly, such as who goes first or which option to take.
How to use the Random Number Generator
- Enter the minimum and maximum values for your range (both are included).
- Set how many numbers you want to generate.
- Tick Allow duplicates for independent picks, or untick it to get unique numbers.
- Optionally tick Sort results to list the numbers in ascending order.
- Click Generate, then click Copy to put the numbers on your clipboard.
Formula & method
Worked examples
Roll a single six-sided die.
- Set minimum to 1 and maximum to 6.
- Set how many to 1 and leave duplicates allowed.
- The range has 6 equally likely values, each with a 1 in 6 chance.
Result: One number from 1 to 6, for example 4
Pick 3 unique winners from 50 entrants.
- Set minimum to 1 and maximum to 50.
- Set how many to 3 and untick Allow duplicates.
- The tool draws 3 distinct numbers without replacement, so no entrant is picked twice.
Result: Three different numbers between 1 and 50, for example 7, 22, 41
Generate 5 numbers between 1 and 10 with duplicates allowed.
- Set minimum to 1, maximum to 10, and how many to 5.
- Keep Allow duplicates ticked so each pick is independent.
- Some numbers may repeat, just like rolling a 10-sided die five times.
Result: Five numbers from 1 to 10, for example 3, 3, 8, 1, 10
Common ranges and what they are used for
| Range | Possible values | Typical use |
|---|---|---|
| 1 to 6 | 6 | A single six-sided die |
| 1 to 100 | 100 | Percentages, simple lotteries, guessing games |
| 1 to 49 | 49 | Lottery-style number picks |
| 0 to 9 | 10 | A single random digit |
| 1 to 2 | 2 | A coin flip (1 = heads, 2 = tails) |
How the duplicates toggle changes the result
| Setting | Method | Can a number repeat? |
|---|---|---|
| Allow duplicates on | Each pick is independent (with replacement) | Yes |
| Allow duplicates off | Draw without replacement (shuffle) | No |
Common mistakes to avoid
- Asking for more unique numbers than the range allows. With duplicates off, you cannot draw more numbers than the range contains. Requesting 10 unique numbers from 1 to 5 is impossible, since only 5 distinct values exist. Widen the range or allow duplicates.
- Assuming the maximum is excluded. Both the minimum and the maximum are included in the range. A range of 1 to 6 can return 1 or 6, not just the values in between, so you get the full count of (max - min + 1) possibilities.
- Expecting an even spread in a small sample. True randomness clusters. In a short run you may see the same number twice or a gap with no low values. That is normal and does not mean the generator is broken; fairness shows over many draws, not a handful.
- Trusting modulo bias from simpler tools. Many quick scripts use a raw value modulo the range, which makes lower numbers slightly more likely. This tool rejects the uneven tail so every value is truly equally likely, which matters for fair draws.
Glossary
- Random number generator (RNG)
- A process that produces numbers that are hard to predict, with each allowed value equally likely within the chosen range.
- Uniform distribution
- A spread where every value in the range has exactly the same probability of being chosen, so no number is favoured.
- Cryptographically secure
- Randomness drawn from a high-quality system source that cannot be predicted or reproduced, as provided by the Web Crypto API.
- With and without replacement
- With replacement means each pick is independent and numbers can repeat. Without replacement means each value is used at most once, like dealing cards.
- Modulo bias
- A subtle skew that appears when a large random value is reduced with the remainder operator and the range does not divide evenly, making some numbers slightly more likely.
Frequently asked questions
How does this random number generator work?
It draws values from your browser Web Crypto API, a high-quality randomness source, then uses rejection sampling to map them into your range without bias. Set a min, a max, and how many numbers you want, and click Generate.
How do I generate a random number between two values?
Enter the lower value as the minimum and the higher value as the maximum, set how many to 1, then click Generate. Both ends of the range are included, so a range of 1 to 100 can return 1, 100, or anything in between.
Can I get random numbers without duplicates?
Yes. Untick Allow duplicates and the tool draws unique numbers without replacement, so no value repeats. You cannot request more numbers than the range contains, since each value can only appear once.
Is this random number generator truly random?
It is as unbiased as a browser can offer. It uses the cryptographically secure Web Crypto API rather than a simple seeded formula, and it removes modulo bias so every value in your range is equally likely.
Can I use it to pick lottery numbers or a raffle winner?
Yes. For a raffle, give each entrant a number and generate one or more unique numbers in that range. For lottery-style picks, set the range and turn off duplicates to draw distinct numbers.
Does the tool send my numbers anywhere?
No. All generation happens locally in your browser with plain JavaScript and the built-in crypto functions. Nothing you enter and no result is uploaded or sent over the network.