Random Number Generator

Draw whole numbers from a range — or pick at random from a list you paste in.

Runs on your deviceCalculatorsWorkingNo account needed

What this tool does

Random Number Generator draws whole numbers from an inclusive range, so a minimum of 1 and a maximum of 6 can produce both 1 and 6. For any range up to about four billion values wide, each draw takes 32 random bits and throws away any sample that would not divide evenly into the range before taking the remainder, which removes the modulo bias a naive implementation quietly introduces and leaves every value equally likely. A range wider than that — bounds in the trillions — is handled differently: a 53-bit double is scaled across the span instead, which is even enough for shuffling or simulation but is not the same exact construction.

The optional input box changes what is being drawn. Paste items one line at a time — entrant names, teams, tasks — and the Minimum and Maximum boxes stop mattering: positions in your list are drawn instead, and the items themselves are printed. Ask for as many items as the list holds with No repeats switched on, and with Order left on As drawn, and you get the whole list shuffled into a running order, which is a different job from picking a single winner but the same two settings.

Leave Seed empty and the numbers come from crypto.getRandomValues, the browser's link to the operating system's random source, with Math.random standing in only on a browser too old to offer that interface. Which of the two actually ran is recorded internally and never printed: the result panel on a text tool shows the numbers and a one-line summary, and that summary names the count, the range and the seed but not the source. Type anything into Seed and the draw switches to a deterministic generator that returns the identical sequence for that seed every time. Repeatability is the point, and it is also the catch — the seed is the whole secret, so a seeded draw is fine for a fixture and wrong for anything that must be unguessable.

A few hard edges are worth knowing before you start. Whole numbers only: a bound of 1.5 is refused rather than rounded, so this is not the tool for random decimals. One draw returns at most 10,000 values, and asking for more unique numbers than the range contains is rejected with an error naming the size of the range instead of silently repeating. Everything happens in this browser tab and nothing is uploaded, which also means the draw leaves no record — no log, no timestamp, nothing a losing entrant could inspect afterwards.

How to use it

  1. Set the range. Minimum and Maximum are both included in the draw, so 1 to 6 is a die and 1 to 49 is a lottery ball. Enter them the wrong way round and they are swapped rather than refused.
  2. Choose how many, and whether repeats are allowed. Up to 10,000 values per draw. With No repeats off the same number can come up twice, which is right for dice throws and wrong for a raffle.
  3. Or paste a list instead of using the range. One item per line in the input box. Blank lines are skipped, and so is any line beginning with # or // — those are read as comments, so an entrant written as "#1 Fan" is dropped before the draw and never has a chance of winning. The tool draws from the lines that survive, prints the items rather than their positions, and ignores the range settings entirely.
  4. Set the order, and a seed if you need one. Results appear in the order drawn unless you pick Ascending or Descending. Those sort the numbers — or, when you are drawing from a list, the hidden positions behind the items, so Ascending on a list hands it back in the order you pasted rather than alphabetically, undoing the shuffle you just asked for. A seed makes the same draw reproducible; leave it blank for a fresh one each time.

Processing & privacy

Runs on your device. Your file is processed directly in this browser.

Common use cases

Rolling dice you do not have

Minimum 1, maximum 6, and as many rolls as the turn needs in one go, so 3d6 is one draw of three numbers rather than three visits to the page. The rolls are printed as they fall and the adding up is left to you.

Picking a winner from a list of entrants

Paste the names and ask for one. The output is a person's name, not a row number you then have to count down a spreadsheet to find.

Choosing lottery numbers

Six from 1 to 49 with No repeats on and ascending order, which is the order the numbers are printed on the slip.

Building reproducible test data

A fixed seed returns the same values on every run, so a test or a demo that depends on those numbers does not drift between executions.

Deciding who goes first

Paste the group, request as many picks as there are names with No repeats on, and leave Order on As drawn — the result is the whole list in a random running order.

Questions

Are the numbers sent anywhere?
No. The draw is computed in this browser tab and neither the numbers nor any list you paste is transmitted or stored. Closing the page discards both.
How random are the numbers really?
With the seed box empty they come from crypto.getRandomValues, which the browser fills from the operating system's random source, and out-of-range samples are discarded rather than folded down with a remainder, so across a range narrower than about four billion no value is favoured. A span wider than that is scaled from a 53-bit double instead — fine for a shuffle, not a strict rejection sample. A browser without that interface falls back to Math.random, and nothing on the page tells you which of the two produced the draw.
What does the seed do?
It replaces the random source with a deterministic generator, so the same seed and the same settings always produce the same numbers. Use it when a draw has to be repeatable, and never when it has to be unpredictable — anyone holding the seed can reproduce the result.
Can I generate decimals?
No. The bounds and the count are all whole numbers, and a fractional value is refused rather than rounded. Draw integers and scale them yourself if you need a step of 0.1.
Why was my request for unique numbers refused?
Because the range does not contain that many distinct values — ten unique numbers between 1 and 6 do not exist. Widen the range, ask for fewer, or turn No repeats off.
I drew from a list and the same name appeared twice
No repeats applies to positions, not to text. Two identical lines are two separate entrants and both can be drawn, so strip duplicate lines before pasting if every name should hold exactly one ticket.
Can I use this to run an official prize draw?
Only where nobody needs convincing afterwards. The draw itself is fair, but it produces no evidence: no log, no timestamp and no third party who witnessed it. A regulated draw needs a documented, auditable procedure instead.
How many numbers can one draw return?
Ten thousand. Past fifty they are written one per line rather than separated by commas, which pastes straight into a spreadsheet column, and items drawn from a pasted list are always one per line however few you ask for.

Related tools