Skip to content
Tejo Tools
Search
Menu
Processed on your device

Random number generator

Pick random whole numbers between a minimum and a maximum, up to 100 at a time. They're drawn on your device.

numbers
Generated values

Your values will appear here.

Last updated

What it does

The random number generator picks whole numbers at random from the range you set. It can draw one number, or up to 100 different numbers at once, between any two whole numbers from −1,000,000,000 to 1,000,000,000.

The page opens with one number from 1 to 100 already drawn. Change Min, Max or How many and a new draw appears straight away. The numbers are shown in the order they were drawn, not sorted.

How to use it

  1. Set Min and Max, the lowest and highest number that can come up. Both are included.
  2. Set How many, from 1 to 100.
  3. Read the draw under the settings. The line under the count says which range it came from, and “no repeats” when you asked for more than one.
  4. Select Copy all for every number, one per line, or Copy next to a single number.
  5. Select Regenerate, or press Ctrl+Enter (⌘+Enter on a Mac), for a new draw with the same settings.

The generator remembers Min, Max and How many on this device, so they’re there the next time you open the page. The numbers themselves are never kept.

How it works

Each number is picked from your browser’s cryptographic random number generator, the same source used for encryption keys. The generator reads the browser’s random bytes 4 at a time, as a 32-bit value from 0 to 4,294,967,295. A plain remainder (modulo) would favour some numbers, because 4,294,967,296 doesn’t divide evenly by most range sizes. So the generator sets aside the few values at the very top that would cause that: for 1 to 100, the last 96 of them. If one of those comes up it’s skipped and the next one is used. What’s left divides evenly, so every number in the range has exactly the same chance.

To make several different numbers, the generator takes them one at a time from the numbers still left in the range, a partial Fisher–Yates shuffle. Each draw is made with the same unbiased step over what’s left, so every possible ordered set of different numbers is equally likely. A range of two billion numbers needs no big list for this: only the numbers already drawn are tracked.

How it’s calculated

A draw of one number from a range of n numbers gives each number 1 chance in n: 1 in 100 for 1 to 100, which is 1%. Several numbers are taken without putting any back, so the first has n choices, the second n − 1, and so on. Three numbers from 1 to 6 can come out in 6 × 5 × 4 = 120 different orders, and each of the 120 has the same chance, 1 in 120.

Every number then has the same chance of being in the draw at all: a given number is among the three in 60 of the 120 orders, which is 50%, or 3 in 6. The first place alone gives each number 1 in 6, about 16.7%.

Worked examples

Three numbers from 1 to 6

Set Min to 1, Max to 6 and How many to 3. If the values drawn are 2, 1 and 0, the draw reads 3, 1, 2, and the line under the count reads From 1 to 6, each equally likely, no repeats. The three are all different, and they stay in the order drawn rather than sorted.

One number from 1 to 100

With the page’s own settings, Min 1, Max 100 and How many 1, a drawn value of 41 gives 42 and a value of 0 gives 1. The line under the count reads From 1 to 100, each equally likely, with no mention of repeats, since there is only one number.

What the odds count

Feeding the draw every possible value for its three places gives 120 draws of 3 numbers from 1 to 6, and all 120 are different. The number 4 is in 60 of them. Over 1 to 100, the 100 values give each number from 1 to 100 once.

Common mistakes

Ranges and repeats

The size of a range is Max − Min + 1, and both ends count. 1 to 10 holds 10 numbers, −5 to 5 holds 11, and 7 to 7 holds just the one. How many can be as large as the size and no larger, so −5 to 5 with How many 11 returns every number from −5 to 5 once, in the order drawn.

Negative numbers are copied with an ordinary hyphen-minus, as -5, so they paste into a spreadsheet as they are. The line under the count writes the range with a proper minus sign instead, as From −5 to 5.

Good to know

Privacy

The numbers are drawn in your browser, on your device. Nothing is sent to a server and the numbers aren’t stored. Only your Min, Max and How many are kept, in this browser’s storage, so the page can show them again.

Advertisements

Frequently asked questions

Is this random number generator really random?

The numbers come from your browser's cryptographic random number generator, crypto.getRandomValues, which browsers fill from the operating system's secure random source. It's the same source used to make encryption keys. Every number in your range is equally likely: the page skips the few raw values that would favour the low numbers, so no number is more likely than another.

Can the same number come up twice?

Not in one draw. When you ask for several numbers, they're all different, like pulling numbered tickets from a bag without putting them back. A new draw, from Regenerate or from changing an option, starts again with every number in the range available, so a number from the last draw can come up again. Because the numbers in one draw are all different, How many can't be more than the size of the range: 1 to 10 holds ten numbers.

Can the range go below zero?

Yes. Min and Max can be any whole numbers from −1,000,000,000 to 1,000,000,000, so −50 to 50 works. The numbers you copy use an ordinary hyphen-minus, like -17, so they paste into a spreadsheet, a program or a message as they are. Max can't be lower than Min.

How do I draw raffle numbers or pick winners?

Number your tickets from 1 up, then set Min to 1, Max to your last ticket number and How many to the number of winners. If 500 tickets were sold and there are 5 prizes, 1 to 500 with How many 5 gives five different winning tickets, in the order drawn. A ticket can't win twice in one draw. For a list of names instead of numbers, use the random name picker.

Does the page keep or send my numbers?

No. The numbers are drawn in your browser and nothing is sent to a server. Only your Min, Max and How many are kept, in this browser's storage, so the page can show them again. The numbers themselves are never kept.

Advertisements