Random Number Generator
Generate cryptographically random numbers in any range — with or without duplicates, optionally sorted.
Presets
How to use
- Set the min / max range and how many numbers to draw.
- Toggle unique if you don't want duplicates.
- Pick a sort order and an output separator.
- Click Generate.
About this tool
ShowHide
Draw numbers from any range, with or without repeats, sorted ascending, descending or left in draw order, separated by commas, spaces or newlines. Presets cover a 6-from-45 lottery line, a 5-from-69 Powerball pick and three dice.
The generator is worth a paragraph because the easy way to build one is subtly wrong. Taking a random 32-bit value and reducing it modulo the range biases the result, because 2³² is not a multiple of most ranges: for a range of 45, 2³² leaves a remainder of 31, so 31 of the 45 outcomes are reachable by one more value than the rest. This tool instead rejects and redraws — it discards any value at or above the largest multiple of the range that fits in 32 bits, which removes the bias entirely. The cost is nothing you will notice: for a range of 45, the fraction of draws thrown away is 0.0000007%.
Unique mode fills a set by drawing until it has enough distinct values, which is the right approach when you want a few numbers from a wide range and a poor one when you want nearly all of them. Six distinct numbers from 1–45 takes about 6.4 draws on average; all 45 of them would take about 198, because the last few values are found only by repeatedly hitting the ones already taken. Asking for more numbers than the range holds is refused rather than looped forever.
One thing no generator can give you is a better lottery ticket. Every combination is equally likely, so avoiding last week's numbers or spreading picks across the grid changes nothing about your chance of winning — it changes only how many people you would share a prize with, since human-chosen lines cluster on birthdays and patterns. Unpredictable is what the cryptographic source here buys you, and that is worth having when the draw decides something real.
Frequently asked questions
How random is it?
Uses crypto.getRandomValues + rejection sampling so every number in the range is equally likely — no modulo bias even when the range doesn't divide evenly into 2³².
Is it good enough for a real lottery draw?
Statistically yes — the same primitive that powers TLS keys. For any official draw you'd still need an auditable process; this is for fair fun and fair selection.
Why does 'unique' have a cap?
If you ask for more unique numbers than fit in your range (e.g. 10 uniques in 1–5), there's no solution. The tool shows a warning instead of looping forever.
What's Powerball / Lotto in the presets?
Powerball uses 5 unique numbers from 1–69 (the main pool). Lotto-style 6/45 uses 6 unique from 1–45. Dice draws 3 numbers from 1–6 with duplicates allowed.
Are the numbers really evenly distributed?
Yes, and the detail that makes it true is easy to get wrong. Simply taking a random 32-bit value modulo the range size makes the first few numbers slightly more likely, because the range rarely divides evenly into 2^32. This tool discards the values that fall in the uneven tail and draws again, so what remains maps onto the range exactly.
Can I reproduce the same draw later?
No. There is no seed to set - a cryptographic generator is designed not to be reproducible, which is the whole point of using one. If you need a draw you can prove and repeat, record the result when you make it; regenerating will not give you the same numbers.
Why not just use the ordinary random function?
For picking a colour or shuffling a playlist, it is fine. It becomes the wrong tool when the outcome matters to someone: an ordinary generator has a fixed internal state that can be inferred from enough outputs, so a sequence is predictable to anyone who cares to work it out. For a prize draw, a team assignment or anything a person might contest, an unpredictable source is worth the nothing it costs.
Guides on this topic
Related tools
Lottery Number Generator
Generate random tickets for 8 popular lotteries (Powerball, EuroMillions, Lotto 6/45, Loto 6, 双色球…) — uses crypto-secure RNG.
Random
Playing Card Drawer
Draw N cards from a properly shuffled 52-card deck (optional jokers), with deck-tracking so you don't draw the same card twice.
Random
Random Picker — Roulette & Ladder
Pick a winner with a spinning wheel or a ladder (ghost-leg) draw.
Random
Raffle Draw
Pick N winners from a list of names — cryptographically random, with or without duplicates.
Random
Random Date Picker
Pick N random dates between two boundaries — with options for unique-only, sorted, and weekdays-only.
Random
Fibonacci Sequence Generator
Generate the first N Fibonacci numbers with exact big-integer precision — with the last term, the running sum and the golden-ratio approximation.
Math & Statistics