Random Number Generator

Pick random numbers between any two values — one or many, with or without repeats.

-

Setting up a draw

  1. Type the lowest and highest value in From and To. Both ends can be drawn. If you enter them the wrong way round, the tool swaps them for you.
  2. Set How many numbers you want, from 1 to 1000.
  3. Tick No repeats when every result must be different, Decimals (with 1 to 6 places) for fractional values, and Sort to list the results from smallest to largest.
  4. Press Generate. Copy puts the numbers on your clipboard as a comma-separated list.

In short

Every number is drawn from your browser's secure random generator without bias toward any value, and the end values of the range come up as often as the rest. No repeats draws each value at most once, like taking numbers from a hat.

Frequently asked questions

How random are the numbers?

They are cryptographically strong and unbiased, which is far better than the generators most programming languages use by default.

Is the end value included?

Yes. Both the From and To values can be drawn.

Why can’t I pick more numbers than the range holds?

With No repeats on, a range of 1–10 has only ten distinct values, so you can draw at most ten.

Is Sort changing which numbers are drawn?

No. The numbers are chosen first and only then arranged in ascending order, so sorting affects display but not the draw itself.

Our test: in decimal mode, do the end values come up as often as the rest?

With From 0, To 1, Decimals on with 2 places and How many 1,000, Generate was pressed 1,010 times in headless Chromium 153.0.8010.12. That gave 1,010,000 values spread over the 101 possible results, so a fair draw should give each result about 10,000 times. As cross-checks we also drew 600,000 whole numbers from 1 to 6 and 210,000 one-decimal values from 0.5 to 2.5.

Expected 10,0000.0010,0110.0110,0160.5010,1590.9910,0341.009,961Average of 0.01 to 0.9910,000
Times drawn out of 1,010,000 (0 to 1, two decimals) — chart drawn from the table below.
ValueTimes drawn
0.00 (lower end)10,011
0.0110,016
0.5010,159
0.9910,034
1.00 (upper end)9,961
Average of 0.01 to 0.9910,000

Across all 101 values the counts ranged from 9,766 to 10,293, and a chi-square test on them gave p = 0.45, which is what an even draw looks like. In the cross-checks, the six die faces landed between 99,773 and 100,337 times each, and the end values 0.5 and 2.5 came up 10,036 and 9,968 times against an expected 10,000.

What it means: the end values are not short-changed. Both 0.00 and 1.00 come up as often as any value in between, so you do not need to widen the range to give the ends a fair chance.

More details

How it works

Numbers come from your browser’s cryptographically secure generator (crypto.getRandomValues), with a correction that keeps every value in the range equally likely. Turn on No repeats to draw without replacement, which is what you need for raffles, lottery-style picks and assigning unique numbers.

Handy ranges

Set 1–6 for a die, 1–10 or 1–100 for a quick pick, 1–45 with six numbers and no repeats for a lottery-style draw, or 0–1 for a coin flip.

How each number is picked without bias

Each draw starts with a 32-bit random value from the browser's crypto.getRandomValues. Turning that into a number in your range is the delicate part. A common shortcut is to take the remainder after dividing, but that slightly favors small results whenever the range does not divide evenly into 232 (4,294,967,296). For a range of 100 values, 4,294,967,296 divided by 100 leaves a remainder of 96, so with the shortcut the first 96 outcomes would each be very slightly more likely than the last four. This tool avoids that: it throws away any raw value above the largest exact multiple of the range size and draws again. The discarded share is tiny, and in return every number in the range has the same chance. The raw values come from the browser's cryptographic random source, not from Math.random().

How No repeats works

With No repeats on and a range of up to 100,000 values, the tool lays out the whole list and performs a partial shuffle: for each position it swaps in a randomly chosen item from what remains. That is the standard way to deal cards, and it never needs to retry. For larger ranges it simply redraws any value it has already seen, which is fast because collisions are rare when the range is big compared with the count. If you ask for more numbers than the range can supply, for example 12 unique values between 1 and 10, the tool tells you how many distinct values exist rather than looping forever.

Decimal draws and negative ranges

For decimals the range is converted to whole steps. With two places, 0 to 1 becomes the 101 values 0.00, 0.01, up to 1.00, each equally likely, and the result is shown with exactly two digits, so 0.5 appears as 0.50. If you leave Decimals off, fractions typed in From or To are rounded inward before drawing (From rounds up, To rounds down), so 1.5 to 6.5 draws from 2 to 6. Negative ranges such as -50 to 50 work normally.

Settings for a die, a lottery pick, a coin and test data

  • A die: From 1, To 6, How many 1. For two dice, set How many to 2 and leave repeats allowed, since both dice can show the same face.
  • Lottery-style pick: From 1, To 45, How many 6, No repeats, Sort. A particular set of six numbers has a 1 in 8,145,060 chance, which is the number of ways to choose 6 from 45. Every set is exactly as likely as any other, including 1-2-3-4-5-6.
  • Coin toss: From 0, To 1, and decide in advance that 0 is heads.
  • Test data: From 0, To 1, Decimals on with 3 places, How many 50 for a quick list of sample values.

Where a draw helps: raffles, classrooms, sampling

  • Raffles and giveaways: number the entries, then draw winners without repeats so nobody wins twice.
  • Classroom and games: choose who goes next, roll custom dice, or set a random starting order.
  • Sampling: pick row numbers to audit from a spreadsheet of a known size.
  • Decisions: when options are numbered, let a number choose for you. These are casual uses; see the note on regulated drawings below.

Why results can look streaky, and what is not supported

  • Random does not mean evenly spread. In ten draws from 1 to 10 you will often see repeats and gaps; that is normal, not a fault.
  • Each press of Generate is independent. Pressing it again does not make a number that has not appeared yet "due".
  • Results are not saved. Copy them before generating again, because the display is replaced.
  • Bounds must lie between -9,007,199,254,740,991 and 9,007,199,254,740,991, and the tool shows a message if the range is wider or too large for the decimal places chosen.
  • For regulated drawings, such as a public lottery, follow the rules of the organiser; a web tool leaves no auditable record of the draw.

More questions

Why do I sometimes see the same number twice in a row?

Without No repeats, each value is drawn independently, so repeats happen at exactly the rate chance predicts. In a range of 10, any two consecutive draws match one time in ten.

Can I reproduce an earlier result with a seed?

No. The generator is deliberately unseeded, so the same settings give different results each time. That suits one-off draws but not repeatable simulations.

Related guides

More in Text & developer