Tools · Everyday Utility

Random Number Generator

Whole numbers from any range, with or without repeats. Every draw comes from a seed that travels in the link, so the numbers you got are the numbers anyone you send it to will get.

Seeded, so a shared link is a shared resultNot for passwordsInputs stay on this device
Your inputs

Set the draw

Included in the draw. Negative numbers are fine.

Also included. 1 through 6 is a die; 1 through 49 is a lottery line.

Up to 100 numbers in one draw.

Raffle tickets and lottery lines come out of a hat once. Dice do not.

The same seed always gives the same numbers, which is what makes a shared link a shared result. Leave it blank for a fresh draw.

Your inputs are calculated locally and are not stored.
Your numbers11, 95, 2, 26, 91, 79

6 numbers from 1 through 100, drawn without replacement, from seed 305,419,896.

Sum
304
Mean
50.6667
Lowest drawn
2
Highest drawn
95
How many
6
Seed
305,419,896
The draw, in the order it came out
PickNumber
111
295
32
426
591
679
  • These numbers come from mulberry32, a fast statistical generator. It is fine for a raffle, a lottery line, or picking who goes first.
  • It is not cryptographic. Never use this page for a password, an API key, a token, or anything else that has to be unguessable.
  • Every number in the range is equally likely, and the draw is fixed by the seed — copy the link and anyone can check it.
Read this first

Good enough for a raffle. Never for a password.

This page uses mulberry32, a fast statistical pseudo-random generator: thirty-two bits of internal state pushed through a couple of multiplies and shifts. It produces a uniform, pattern-free stream and it passes the small statistical batteries generators are screened with. For picking a raffle winner, filling a lottery line, choosing who goes first, or sampling rows out of a spreadsheet, it is entirely sound.

It is not a cryptographic generator, and the difference is not a matter of degree. Thirty-two bits of state means there are about four billion possible states — a number a laptop can search exhaustively in a fraction of a second. Anyone who sees a couple of numbers from your draw can recover the state and then produce every number you are going to get next. A statistical generator is built to look random; a cryptographic one is built to resist someone trying to predict it, and only the second property is worth anything when the output is a secret.

So: passwords, passphrases, API keys, session tokens, salts, nonces, recovery codes, shuffled decks in a game played for money — none of them should come from this page, or from any page like it. Use a password manager, or a cryptographic generator directly: crypto.getRandomValues in a browser, crypto.randomBytes in Node, secrets.token_urlsafe in Python. Those are one line of code and they are the right tool. This one is not.

The one place a cryptographic generator does appear here is the seed: when you open the page or press New numbers, the starting value comes from your browser’s crypto.getRandomValues. That is only so two visitors do not land on the same draw. Everything after the seed is mulberry32, and mulberry32 is what the warning above is about.

Formula & methodology

How a number gets drawn

The generator emits a value between 0 and 1. Scaling that to a range is one line, and both ends are inclusive — 1 through 6 is six outcomes, not five.

size = max − min + 1  •  n = min + ⌊u × size⌋
u
The generator’s output, in [0, 1)
size
How many whole numbers the range contains
n
The number drawn

With repeats allowed, that line runs once per number and nothing else is needed. With repeats off, the draw has to be made without replacement, and the obvious approach — draw a number, throw it away if you have seen it, try again — falls apart exactly when you need it. Picking all 100 numbers from 1 through 100 that way spends its final picks retrying dozens of times each, and picking 99 of them is worse still.

Instead the tool runs a partial Fisher–Yates shuffle. Imagine the whole range laid out in order; swap the first slot with a randomly chosen slot, then the second with a random slot from those remaining, and stop after as many swaps as you need numbers. Each swap costs the same regardless of how much is left, so 100 picks from 100 is no slower than 6. The range itself is never actually built — only the slots that get touched are recorded — which is why a range of a billion numbers costs nothing.

Worked example

Six numbers from 1–100, seed 12345

Seeding mulberry32 with 12345 and drawing six distinct numbers from 1 through 100 gives 98, 32, 50, 83, 53, 39 — in that order, every time, on any machine. They add to 355, which is a mean of 59.1667; the lowest is 32 and the highest is 98.

Watch what changes when repeats are switched on but the seed is left alone: the same stream of random values now feeds a different rule, and the draw becomes 98, 31, 49, 82, 51, 35. The first number is identical because the first pick spans the full range either way. The rest drift apart because the unique draw is picking from a range that shrinks by one each time, so the same underlying value lands on a different number.

A mean of 59.1667 sitting above the range’s midpoint of 50.5 is not a fault. Six draws is a tiny sample, and a tiny sample of a uniform distribution wanders. Draw 100 numbers instead and the mean will sit far closer to the middle; that is what the sum and mean are shown for.

Assumptions

What this generator assumes

  • Whole numbers only. There is no decimal mode, no weighting, and no distribution other than uniform — every number in the range is exactly as likely as every other.
  • Both bounds are included. A range of 1 through 49 can produce a 1 and can produce a 49.
  • The draw is a function of the seed alone. Nothing about the time, your device, or your session enters into it, which is what makes a shared link reproducible — and what would make it predictable if the seed were guessable.
  • Leaving the seed blank means a fresh seed is drawn once, when the page loads, from the browser’s cryptographic generator. Reloading gives a different draw; pressing New numbers gives a different draw and writes the seed down.
  • The generator’s output carries 32 bits of resolution. For ranges up to a few million that is uniform to well below any measurable bias; across the full billion-wide range the spacing between reachable values becomes visible in principle, and still irrelevant to anything this tool is for.
Common questions

Random number FAQ

Is this random enough to pick a raffle winner?

Yes. Every number in the range is equally likely, the draws are independent, and the generator passes the standard statistical batteries used to check for patterns. For choosing a winner, a lottery line, a chore rota or who goes first, that is exactly the property you need. What it is not is unpredictable to someone who is trying — which matters for keys and passwords, and does not matter for a raffle.

Can I use this to make a password or an API key?

No. Use a password manager, or your language's cryptographic generator — crypto.getRandomValues in a browser, crypto.randomBytes in Node, the secrets module in Python. The generator here keeps 32 bits of internal state, which means someone who sees a couple of your numbers can work out the state by brute force in well under a second and then predict every number that follows. That is a fatal flaw for a secret and completely irrelevant for a raffle, which is why this page draws a hard line between the two.

What is the seed, and why would I set one?

The seed is the number the sequence starts from. The same seed always produces the same draw, so setting one turns a random result into a repeatable one. Leave the box blank and the page picks a fresh seed each time you open it. Fill it in — or press New numbers, which fills it in for you — and the draw is pinned.

Why does a shared link show the same numbers to everyone?

Because the seed travels in the link, and that is the point. If you draw six numbers and send a screenshot, nobody can check it. If you send the link, they see the same six numbers you did and can see the range and settings that produced them. It is the difference between announcing a result and publishing one.

Can the same number come up twice?

Only if you allow it. With repeats off, the draw is made without replacement — every number differs, which is how raffle tickets and lottery balls behave. With repeats on, each number is drawn independently from the whole range, which is how dice behave. Roll two dice and double sixes have to be possible.

How many numbers can I draw at once?

Up to 100, from any range between minus one billion and one billion. With repeats off the draw obviously cannot be wider than the range it comes from — you cannot pick eight distinct numbers from 1 through 5 — and the tool says so rather than quietly repeating one.

Primary sources

Sources and review notes

  1. NIST SP 800-90A Rev. 1 — what a generator has to satisfy before it may be used for anything security-relevant
  2. W3C Web Cryptography API — the specification for crypto.getRandomValues, the browser generator that supplies this page’s seed
  3. R. Durstenfeld, “Algorithm 235: Random permutation”, Communications of the ACM 7(7), 1964 — the shuffle used for draws without repeats

The arithmetic on this page is exact and has no data behind it to go stale. The sources are cited for the boundary the page draws between a statistical generator and a cryptographic one, and for the shuffle, not for the numbers themselves.