Skip to content

Random number generator

Draw random numbers in any range, with or without repeats, as whole numbers or decimals — plus dice and coin modes, from the browser’s secure generator.

  • Runs in your browser
  • Nothing you enter is sent
  • Free, no account
Range

Up to 10,000.

Number type
Order

Draws without replacement, the way a raffle or a lottery does. Leave it off for dice rolls and simulations, where every draw must be independent.

How to use it

  1. Set the minimum and maximum. Both ends are included, so 1 to 6 can produce a 1 or a 6.
  2. Choose how many numbers you want — up to ten thousand at a time.
  3. Turn on “no repeats” for a raffle or a lottery draw. Leave it off for dice, simulations and anything where each draw must be independent.
  4. Sort the output if you need it in order, then copy it as a list or a comma-separated line, or download it as a text file.
  5. The Dice and Coin tabs cover the two cases people ask for most often, with the same generator behind them.

Where the randomness comes from

Every value here is drawn from crypto.getRandomValues, the browser’s cryptographically secure pseudo-random generator. It is seeded from operating-system entropy — timing jitter, hardware sources, interrupt noise — and is the same facility used to generate encryption keys and session tokens.

That is a meaningful step up from Math.random(), which most online generators use. Math.random() is a fast pseudo-random algorithm (xorshift128+ in V8) with an internal state that is not secret and is not reseeded. It is perfectly good for shuffling a carousel and completely unsuitable for a prize draw, because someone who observes enough output can reconstruct the state and predict the rest.

The modulo bias, and why it matters

The obvious way to get a number in a range is to take a random integer and apply the remainder operator. It is also subtly wrong. Suppose you have a generator producing 0–255 and you want 0–99:

value % 100

value 0–55   →  0–55 can each be produced 3 ways  (v, v+100, v+200)
value 56–99  →  56–99 can each be produced 2 ways (v, v+100)

Low results are 50% more likely than high ones.

The fix is rejection sampling: discard any value in the unbalanced tail and draw again. This tool computes the largest multiple of the range that fits in 2³², rejects anything at or above it, and only then takes the remainder. The cost is an occasional extra draw; the benefit is that every number in your range is exactly as likely as every other. Decimals use a full 53-bit mantissa built from two 32-bit words, rather than the 32 bits most implementations settle for.

With or without repeats

Repeats allowed No repeats
Statistical modelSampling with replacementSampling without replacement
Physical analogueRolling a die repeatedlyDrawing tickets from a hat
Each draw independentYesNo — earlier draws change the odds
Maximum countUnlimitedThe size of the range
Use forDice, simulations, test data, coin flipsLotteries, raffles, team picking, seating plans

When the request is dense — say 40 different numbers from 1 to 50 — rejection sampling would spend most of its time rediscovering numbers it already has. The tool switches to a partial Fisher–Yates shuffle over the whole range in that case, which produces the draw in a single pass regardless of how close to saturation it gets.

Common ranges

Task Range Count Repeats
Coin flip1–21Allowed
Standard die1–61Allowed
Percentage roll1–1001Allowed
UK Lotto1–596No repeats
Powerball main numbers1–695No repeats
EuroMillions main numbers1–505No repeats
Pick a winner from 480 entrants1–4801Either
Randomise a 24-person seating plan1–2424No repeats

Running a draw people will trust

The generator is rarely the part anyone disputes — the process around it is. A few things that help:

  • Fix the rules before you draw. Publish the range, the number of winners and the tie-break rule in advance.
  • Number the entrants first, in a list you can show afterwards, then draw index numbers rather than names.
  • Record the draw. A screen recording of the range being set and the button being pressed answers almost every objection.
  • Decide the redraw rule beforehand — what happens if a winner is ineligible, or if the same number comes up twice.
  • Keep the output. Nothing is stored here, so download the text file at the time.

Dice and coins

The Dice tab rolls any number of dice from d4 to d100 with an optional modifier, shows each die individually and keeps the last twenty rolls. Because every die is an independent draw from the same secure generator, it is fairer than a physical die — injection-moulded plastic dice have measurable bias from the hollowed-out pips and from mould draft.

The Coin tab flips up to a thousand times and reports the head and tail counts alongside the longest run. That last figure surprises people: in a hundred fair flips a run of six or seven identical results is entirely normal, and its absence would be the suspicious result. Humans asked to fake a random sequence almost never write a run that long, which is precisely how such fakes are detected.

Questions

Is this actually random?

It draws from crypto.getRandomValues, the browser’s cryptographically secure generator, which is seeded from operating-system entropy. That is the same source used for encryption keys — far stronger than Math.random(), which is a fast pseudo-random algorithm with a predictable internal state.

Why does the range matter for fairness?

Mapping a 32-bit random value onto a range with the modulo operator makes low values slightly more likely whenever the range does not divide evenly. This tool rejects and redraws the values in that unbalanced tail, so every number in your range is exactly as likely as every other.

What does “no repeats” do?

It draws without replacement, like pulling raffle tickets out of a hat. With repeats allowed, every draw is independent — which is what you want for dice, simulations and anything statistical.

Can I use this for a prize draw?

Yes, and it is fairer than most alternatives. For anything with legal weight, record the range, the count and the winning numbers, and take a screen recording of the draw — the fairness of the generator is rarely the part anyone disputes.

Do the numbers get sent anywhere?

No. Generation happens in this tab, there is no server call, and nothing is logged. That also means the results cannot be recovered once you leave the page, so download or copy anything you need to keep.