ADVERTISEMENT

Mobile Banner
320×100

Random Number Generator

Generate random numbers within any range you specify

How Random Numbers Work

Range Formula
Loading formula...
Uniform Distribution
Loading formula...
Probability
Loading formula...

About Random Number Generation

Random number generators (RNGs) create sequences of numbers that lack any pattern. This generator uses cryptographically secure randomness when available, ensuring fair and unpredictable results for games, drawings, and selections.

Each number in your specified range has an equal probability of being selected. If you generate 10 numbers between 1-100, each number has a 1% chance on each pick. With duplicates allowed, the same number can appear multiple times.

These random numbers are generated client-side in your browser using the Web Crypto API when available, falling back to Math.random(). They're suitable for games and casual use, though not for cryptographic purposes.

Common Uses

🎲

Dice & Games

Simulate dice rolls, card draws, or any game of chance. Set 1-6 for a die.

🎫

Raffles & Lotteries

Draw winning numbers or pick random winners from a list of entries.

📊

Random Sampling

Select random participants for surveys or random items for testing.

🔀

Decision Making

Can't decide? Let random numbers choose between options for you.

Quick Presets

Use CaseMinMaxQuantity
Standard Die161
Pair of Dice162
Coin Flip121
Lottery (1-49)1496 (no dupes)
Playing Card1521
Percentage01001

Tips for Fair Random Selection

🚫

Disable Duplicates for Draws

For raffles and lotteries, turn off duplicates so each number/person can only be selected once.

📝

Document the Process

For important drawings, record the settings used and results for transparency.

🔄

Re-generate if Needed

If you need a new set, simply regenerate. Past results don't affect future generations.

🎯

Test First

Run a few test generations to ensure your settings produce the expected results.

Frequently Asked Questions

Are these numbers truly random?

They're pseudorandom, generated by algorithms seeded with unpredictable values. For games and everyday use, they're effectively random. For cryptographic security or high-stakes applications, specialized systems are required.

Can the same number appear twice?

Only if you allow duplicates. With duplicates disabled, each number can only appear once in your results—perfect for drawings where you need unique selections.

How do I pick a random item from a list?

Number your items 1 through N, then generate one random number in that range. The number corresponds to your selected item. Or generate multiple to pick multiple winners.

Is there a pattern to the numbers?

No discernible pattern. Each generation is independent of previous ones. The 'gambler's fallacy'—thinking a number is 'due'—doesn't apply. Each number has equal probability every time.

Examples

Pick a random integer between 1 and 100

A teacher wants to call on one of 100 students at random. They set the range from 1 to 100 and request a single number, with duplicates allowed (irrelevant when quantity is 1).

ResultOne integer in [1, 100], each with probability 1/100 = 1%.

The browser calls crypto.getRandomValues to fill a 32-bit unsigned integer, rejects values that would bias the result (a technique called rejection sampling), then maps the remaining value into the inclusive range 1-100 using the formula min + floor(r * (max - min + 1)). Because crypto.getRandomValues is seeded from the operating system's entropy pool, the result cannot be predicted from previous draws.

Roll a 20-sided die (1d20)

A tabletop role-playing player needs a single d20 roll to resolve a saving throw. They configure the generator for a single number in the range 1 to 20.

ResultOne integer in [1, 20]; each face has probability 1/20 = 5%.

For a 1d20 roll, the generator returns any value from 1 through 20 with equal 5% probability. Re-rolling does not change the odds: the so-called gambler's fallacy is wrong, because each draw is independent. Over many rolls the empirical distribution will converge to a flat histogram, which is exactly what a fair d20 should produce.

Frequently asked questions

What is the difference between a PRNG and a TRNG?

A pseudo-random number generator (PRNG) is a deterministic algorithm: given the same seed, it produces the same sequence. A true random number generator (TRNG) extracts entropy from a physical process such as thermal noise, atmospheric noise, or quantum effects, so its output cannot be reproduced even with full knowledge of past values. Most software, including this tool, uses a cryptographic PRNG (CSPRNG) seeded from the operating system's entropy pool, which is fed by hardware sources and is unpredictable in practice.

Is this random number generator truly random?

It is not a TRNG. It calls the browser's Web Crypto API (crypto.getRandomValues), which is a cryptographically secure PRNG seeded from operating-system entropy. The output is unpredictable for any practical purpose, including games, raffles, and unbiased selection, but a dedicated hardware RNG or services such as random.org (which samples atmospheric noise) provide genuine physical randomness if you need a TRNG.

Why is Math.random() not safe for cryptography?

Math.random() in JavaScript engines is a fast non-cryptographic PRNG, historically based on algorithms like xorshift128+. Its internal state can be recovered by an attacker who observes only a handful of outputs, which means past and future values become predictable. MDN explicitly warns against using Math.random() for anything security-related. Use crypto.getRandomValues for tokens, keys, passwords, and any draw that must resist tampering.

Can I set a seed to reproduce results?

Not in this tool. crypto.getRandomValues deliberately exposes no seed, because reproducibility would defeat its security purpose. If you need a reproducible sequence (for example, regression tests or shared simulations), use a seeded PRNG such as Mulberry32 or PCG and document the seed alongside the results. For audited drawings, document the inputs, timestamp, and full output list instead of trying to replay the draw.

Are the numbers uniformly distributed?

Yes. The generator uses rejection sampling so that each integer in [min, max] has identical probability 1 / (max - min + 1). A naive approach using modulo on a 32-bit value introduces small bias when the range does not evenly divide 2^32; rejection sampling avoids this. Over a large number of draws the histogram converges to flat, and standard chi-square tests applied to crypto.getRandomValues output show no statistically significant deviation from uniform.

Is this fair enough for important decisions or drawings?

For casual fair-decision use - picking a winner from a list, choosing who pays the bill, deciding between options - yes, because each number is equally likely and unpredictable. For legally regulated drawings (raffles with prizes, audited lotteries) you typically need a documented procedure, often with a third-party witness or a publicly auditable source such as random.org's signed draws or a certified hardware RNG. Record the range, count, duplicates setting, and full result list for any drawing you may need to defend later.

How does this differ from random.org?

Random.org is a TRNG that samples atmospheric radio noise on dedicated hardware, then offers signed and certified draws useful for audits and prize promotions. This generator is a CSPRNG running entirely in your browser, with no network call, so it is faster and works offline but does not produce a third-party audit trail. For everyday randomness both are effectively unpredictable; for regulated drawings random.org's signed records are often the safer choice.

Sources

Pro Tips

  • Bookmark this calculator for quick access in the future
  • Use the share button to send your results to others
  • Try different scenarios to compare outcomes
  • Check out our related calculators for more insights

Found this calculator helpful? Share it with others:

Embed this calculator