Home › Generators › Random Number Generator
🎲

Random Number Generator

Generate random numbers between any minimum and maximum. No-repeats, seeded, decimal and dice modes — fair draws for games, giveaways and decisions, free.

About this tool

Need a fair way to pick a winner, roll virtual dice, or choose a number out of thin air? A random number generator gives you unbiased integers between any minimum and maximum you set. It is perfect for giveaways, classroom activities, games and everyday decisions.

Unlike simple scripts that use predictable math, this tool draws from your browser's cryptographic random source and uses rejection sampling, so every number in the range has exactly the same chance, with no hidden patterns. You can also ask for unique numbers only, sort the results, copy them, generate decimals, or use a seed to reproduce a draw. Everything happens on your device, instantly and free.

By Azhar Hussain · Last updated: 7 November 2026

How to use

Pick a preset — dice (1 to 6), coin flip (0 or 1), lottery (6 unique numbers from 1 to 49), standard (1 to 100) or D20 — or set your own minimum, maximum and how many numbers you want, up to 1,000 at a time. Choose whole numbers or decimals, allow repeats or switch on "No repeats" for unique numbers only, and pick the sort order. Click Generate Numbers and your list appears immediately, with a statistics line for multi-number draws.

For a raffle, set minimum 1 and maximum to your number of tickets. For dice, use 1 to 6 or switch to Dice mode, which rolls 2- to 100-sided dice and shows the total and average. Each click produces a fresh, independent set of numbers, so keep clicking until you have what you need. Use the Copy list, Copy CSV or Copy JSON buttons to take the results with you.

For a draw anyone can check afterwards, switch the random source to Seeded, type a seed word, and publish the seed and the settings before you generate. The same seed and settings always give the same draw — that is the honest way to run a public giveaway.

The math behind it

This tool does not claim "true randomness" — that would need a physical entropy source, like atmospheric noise. What it uses is your browser's cryptographic random source, crypto.getRandomValues: a cryptographically strong pseudorandom generator seeded from the operating system's entropy, so the results are for all practical purposes unpredictable. It is the same quality of randomness used to generate security keys, and far better than the basic Math.random function found in casual scripts, which is fine for games but technically predictable.

Each draw starts from a random fraction between 0 and 1. The formula is: result = Math.floor(random × (max − min + 1)) + min. The naive way to turn a random 32-bit value into a number in your range is to take the remainder after dividing by the range size — but that remainder is slightly biased whenever the range size does not divide 2³² evenly, because some values get one extra chance. This tool uses rejection sampling instead: any random value that would make the results uneven is thrown away and drawn again, so every integer between minimum and maximum — both ends included — is exactly equally likely. The largest range handled exactly is 4,294,967,296 values (2³²), for example 0 to 4,294,967,295; beyond that the arithmetic itself cannot stay exact.

The formula, with a worked example

Every draw starts from a random fraction between 0 and 1. The formula is result = Math.floor(random × (max − min + 1)) + min, where max − min + 1 is the number of possible values — so the range 1–100 has 100 possible values, and 1–6 has 6, exactly like a die.

Worked example: generate one number from 1 to 100. The range size is 100. Suppose the random fraction is 0.4128: Math.floor(0.4128 × 100) + 1 = Math.floor(41.28) + 1 = 41 + 1 = 42.

Dice example: roll two 6-sided dice. The first random fraction is 0.62: Math.floor(0.62 × 6) + 1 = Math.floor(3.72) + 1 = 3 + 1 = 4. The second is 0.95: Math.floor(0.95 × 6) + 1 = Math.floor(5.7) + 1 = 5 + 1 = 6. Total 4 + 6 = 10, average 10 ÷ 2 = 5.00.

Three dice: rolls 4, 6 and 2 give a total of 12 and an average of 12 ÷ 3 = 4.00.

In this tool the random fraction comes from crypto.getRandomValues with rejection sampling (see "The math behind it" above), so the worked example is not just an approximation — each value really does have the same chance.

What chance does each number have?

Because every value in the range is equally likely, each value's chance is simply 1 ÷ the number of possible values. A range of 1–10 gives each number a 1 in 10 chance (10%); a range of 1–100 gives each number a 1 in 100 chance (1%).

RangePossible valuesChance for each value
1–6616.67%
1–101010%
1–20205%
1–49492.04%
1–1001001%
1–100010000.1%

That also means a small sample can look lopsided: ten draws from 1–100 will usually not cover the range evenly, and a mean far from the middle of the range is normal for a handful of draws. That is not a fault in the generator — it is what randomness looks like. With hundreds of draws the counts even out.

Settings for common uses

Start from one of these, then adjust. "Allow repeats: Off" means repeats are switched off, so every number in the draw is unique — use it whenever you are picking winners, not just one number.

Use caseMinMaxCountAllow repeatsType
Raffle — one winner from 200 entries12001OffWhole number
Pick 3 winners from 500 entries15003OffWhole number
Pick a random student from 301301OffWhole number
Simulate a 6-sided die161OnWhole number
Roll a D201201OnWhole number
Pick a random month1121OffWhole number
Random decimal between 0 and 1011OnDecimal
Generate 10 test values1100010OnWhole number

For a lottery-style set, pair "No repeats" with ascending sort: 6 unique numbers from 1 to 49, smallest first, reads like a lottery ticket. For test data, 10 values from 1 to 1,000 with repeats allowed is a quick sample.

Running a fair giveaway, step by step

  1. Number the entries — give every entrant a number from 1 to the total number of entries, in a list everyone can see.
  2. Screenshot the list before the draw, so nobody can say entries were added or removed afterwards.
  3. Screenshot the settings — minimum, maximum, how many numbers, and whether repeats are allowed.
  4. Generate the winning number (or numbers, with repeats off for multiple prizes).
  5. Screenshot the result immediately, including the statistics line.
  6. Share the screenshots publicly so everyone can see the draw happened as described.
  7. Look up the winner in the numbered list and announce them.

For a draw anyone can verify later, use seeded mode instead: publish the seed and the settings before the draw, run it, and anyone can reproduce the exact result with the same seed. Cryptographic randomness gives a result nobody can predict; seeded randomness gives a result everyone can check.

Dice and coin flips on this page

Switch the mode to Dice roll to roll 1 to 50 dice with 2 to 100 sides each — d4, d6, d8, d10, d12, d20, d100 or any custom size in between — and see each die, the total and the average. Switch to Coin flip to flip 1 to 200 coins and see the heads/tails tally. Both modes use the same crypto.getRandomValues source with rejection sampling, so every face and every flip is exactly 50/50 or equally likely.

For deeper dice work — dice notation like 2d6+3, advantage and disadvantage on a d20, and D&D ability scores — use our dice roller, which is built for tabletop games.

Common mistakes

  1. Expecting no repeats by default. Repeats are normal: each number is drawn independently, just like rolling dice. Switch on "No repeats" when you need unique numbers.
  2. Assuming the range excludes the maximum. Both ends are included: 1 to 6 can return 1 and 6, exactly like a die.
  3. Treating a small sample as unfair. Ten draws from 1–100 will not look even. Small samples are noisy — that is not a fault in the generator.
  4. Using decimals for money. Decimal results are subject to floating-point representation (0.1 + 0.2 is not exactly 0.3 in a computer). Never use them for money or anything that needs exact decimal arithmetic.

Honest limitations

How it works

Draws use crypto.getRandomValues, the cryptographic random source built into your browser, seeded from the operating system's entropy. Rejection sampling throws away any random value that would make some outcomes more likely than others, so every integer in the range has exactly the same chance. Seeded mode uses the xoshiro128** algorithm from your seed, so the same seed and settings always reproduce the same draw. Unique numbers use a partial Fisher–Yates shuffle, which picks each value once without ever looping forever. Both ends of the range are included, up to 1,000 numbers per click, with a largest range of 4,294,967,296 values.

Nothing you generate is sent anywhere: every draw happens in your browser, and the page works offline once it has loaded. The figures on this page are computed from the tool's own formulas — the worked examples, the probability table and the statistics line all come from the same arithmetic the tool runs.

Frequently asked questions

Are the numbers truly random?
Not in the physical sense — true randomness would need a physical entropy source, like atmospheric noise. This tool uses your browser's crypto.getRandomValues, a cryptographically strong pseudorandom generator seeded from the operating system's entropy. For all practical purposes the results are unpredictable, and with rejection sampling every value in the range has exactly the same chance. It is the same quality of randomness used to generate security keys, far better than the basic Math.random function found in casual scripts.
Can numbers repeat in the results?
By default, yes — each number is drawn independently, so repeats are possible and normal, just like rolling dice. If you need unique numbers, switch on "No repeats": the tool then draws each value only once, using a partial Fisher–Yates shuffle, and sorts them if you ask it to. That is the right setting for drawing several different winners.
What is the largest range I can use?
The largest range handled exactly is 4,294,967,296 values (2 to the power of 32) — for example 0 to 4,294,967,295. Minimum and maximum must also be integers your browser can hold exactly, within 9,007,199,254,740,991. Typical uses like 1 to 100, 1 to 1,000, or 1 to 1,000,000 all work perfectly. You can generate up to 1,000 numbers per click.
Can I get the same numbers again later?
Yes, with seeded mode. Switch the random source to Seeded, type a seed word or phrase, and generate: the same seed and the same settings always give the same draw. Publish the seed and the settings before a public draw and anyone can reproduce and check the exact result. Do not use seeded mode for anything an adversary could guess the seed for.
What happens if I ask for more unique numbers than the range holds?
The tool refuses and explains why — for example, asking for 10 unique numbers from 1 to 5 is impossible, because that range only holds 5 different values. Widen the range or ask for fewer numbers. It never silently returns duplicates and never loops forever trying.
Are the minimum and maximum included?
Yes, both ends are included. A range of 1 to 6 can return 1 and 6, exactly like a six-sided die, and a range of 1 to 100 can return 1 and 100. If you need a range that excludes an end, set the minimum or maximum one step inward.
Should I use this for lottery numbers?
You can use it to pick lottery numbers — for example 6 unique numbers from 1 to 49, sorted ascending — but no generator can improve your odds of winning. Every combination has exactly the same chance, so a "lucky" set is no more likely to win than any other.
Can it produce negative numbers?
Yes. Set the minimum below zero, for example −50 to 50, and the tool draws from the whole range including negatives. Decimal mode also works with negative ranges.
Can I generate decimal numbers?
Yes. Choose decimal output and set the number of decimal places — for example 0.7423 in the range 0 to 1, or 4.7823 in the range 1 to 10. Decimals are drawn uniformly across the range. Do not use them for money: decimal results are subject to floating-point representation, so they are not exact for currency.
Why is every number equally likely?
The tool uses rejection sampling. It draws a random 32-bit value from crypto.getRandomValues and discards any value that would make some outcomes more likely than others, then draws again. The naive shortcut — taking the remainder after dividing by the range size — is slightly biased whenever the range size does not divide 2 to the power of 32 evenly. Rejection sampling removes that bias completely.
Can I use this for passwords or security keys?
No. This tool is for draws, games and decisions. For passwords use the password generator, which is built for secrets. And for regulated lotteries or legally binding draws, use an audited or certified draw system — this tool is not a substitute for one.
Does the history save between visits?
No. Recent results keep your last 15 draws in the current browser tab only, and they clear when you refresh the page or close the tab. Nothing is stored on a server or sent anywhere — use the Copy list, Copy CSV or Copy JSON buttons if you want to keep a result.

Related tools

💬 Comments

Have a question about this page, or an idea to make it better? Share it below — your feedback helps everyone who uses this site.