Calculators
Random number generator 1 to 5
Choose Generate numbers for a whole number between 1 and 5, where each of the five has a 20% chance. Type 5 or 20 into How many numbers to get that many at once, and turn on No repeats when each number may appear only once. The numbers are generated in your browser.
Drawing one number or many
When the page opens, Minimum value is 1, Maximum value is 5 and How many numbers is 1, with Number type set to Integers. So a single click on Generate numbers returns one of 1, 2, 3, 4 and 5.
- Select Generate numbers for the first draw.
- Change How many numbers to 5 or 20 and select Generate again for a list, one number per line.
- Use Copy results for the clipboard, or Download .txt to save random-numbers.txt.
Each list replaces the one before it. Changing a field clears the box, and Reset returns to the opening state of 1 to 5 with one number. A long list needs no extra steps: a count of 1,000 works the same way as a count of 5, and Cancel stops a run that takes too long, such as a request for a billion numbers.
Five random numbers and twenty random numbers
Asking for five random numbers from 1 to 5 can mean two different things. With repeats allowed, each of the five lines is a separate draw, and a list such as 3, 3, 1, 5, 3 is normal. Only 3.84% of such lists contain all five numbers once each.
With No repeats and a count of 5, the list is always 1 to 5 in a shuffled order, such as 5, 3, 4, 2, 1. That is one of 120 possible orders, each with a chance of 1 in 120. In 60,000 such lists from the engine, each order appeared between 445 and 566 times, against an expected 500.
Twenty numbers from 1 to 5 need repeats, because the range holds only five values. With repeats allowed, each number is expected about 4 times in a list of 20. A given number is absent from all 20 draws just 1.15% of the time, and all five appear in 94.3% of such lists.
Odd, even and the average
Three of the five numbers are odd (1, 3 and 5) and two are even (2 and 4), so a draw from 1 to 5 is odd 60% of the time. To split a group into two halves of equal chance, this range does not work; use 1 to 4 or 1 to 6 instead, where odd and even each come up half the time.
The middle of the range is 3, and the average of many draws settles near it. In a check of 1,000,000 draws through the real engine, the average was 2.998, and each number came up between 199,220 and 200,995 times against an expected 200,000. Odd numbers made up 59.9% of that run.
On a 1 to 5 rating scale, a random draw gives a baseline to compare real answers with: random answers average 3 and use every score equally. Real ratings rarely look like that, and the generator does not try to imitate them.
How five values stay equal
The generator reads random bytes from Web Crypto, the browser's cryptographic random source. Five values need 3 bits, so it keeps the lowest 3 bits of a byte, a value from 0 to 7. The values 0 to 4 become the numbers 1 to 5. The values 5, 6 and 7 are rejected, and the generator reads another byte.
Each number therefore owns exactly 32 of the 256 byte values, and 96 byte values lead to a new try. Five of every eight bytes are kept, 62.5%, so one number takes 1.6 bytes on average.
The shortcut of dividing a byte by 5 and keeping the remainder would tilt the result. 256 is 51 fives plus 1, so 1 would own 52 of the 256 byte values, a 20.31% chance, while 2, 3, 4 and 5 would own 51 each, 19.92%. Rejection removes that tilt, which is why the generator never uses the remainder method.
No repeats with five numbers
No repeats turns the draw into a draw without replacement. The first number is picked from all five, the next from the four left, and so on, so no number can appear twice in one list. How many numbers can then be 1 to 5 in this range.
A count of 2 or 3 with No repeats gives a random pair or trio of different numbers, which is handy for picking two or three winners among five entries. Each possible pair has the same chance. A count of 6 or more shows an error beside How many numbers, saying there are fewer available values than the requested count, and nothing is generated.
With repeats allowed instead, a repeat turns up quickly. Two draws match 20% of the time, three draws contain a repeat 52% of the time, and four draws 80.8% of the time. No repeats applies within one list only, so selecting Generate again can bring back numbers from the previous list.
Limits
The page produces numbers as text. It has no wheel animation and no lottery rules, and it cannot pick entries by name; number the entries, or shuffle the names with the list tool below. Every number has the same weight, and the page has no setting to change that.
The generator stores nothing. It keeps no history of earlier draws, cannot stop a number from returning in a later list, and cannot produce a record that proves a draw was fair to other people. Leaving the page clears the result.
Other ranges only need a new Minimum value or Maximum value, such as 1 to 10. How many numbers has no upper limit set by the tool. Past 10,000 numbers the box shows the first 10,000, and Copy results and Download .txt still include every number. Without JavaScript or Web Crypto, the page shows a message in place of numbers.
Questions
What is a random number between 1 and 5?
Any of 1, 2, 3, 4 or 5, each with the same 20% chance. Select Generate numbers on this page to get one; it opens set to one whole number from 1 to 5. Every draw is independent, so the next one can repeat the last, again with a 20% chance.
Can you give me 5 random numbers?
Yes: set How many numbers to 5 and select Generate numbers. With repeats allowed you get five separate draws, such as 2, 5, 2, 1, 4. With No repeats selected you get 1 to 5 once each, in one of 120 equally likely orders. Copy results copies all five lines.
Can you give me 20 random numbers?
Yes. Set How many numbers to 20 and leave No repeats off, because 1 to 5 holds only five values and No repeats would give an error. Each number then appears about 4 times on average. For 20 different numbers, raise Maximum value to 20 or more before you generate.
Is every number from 1 to 5 equally likely?
Yes. Each number owns exactly 32 of the 256 byte values that the generator reads, and the rest are rejected rather than folded in with a remainder. In a check of 1,000,000 draws, each number came up between 199,220 and 200,995 times, against an expected 200,000.
Related tools
- Number the lines of a list: give five names the numbers 1 to 5 before you draw.
- Weighted average calculator: average scores that carry different weights, such as survey answers on a 1 to 5 scale.
- Random numbers from any range: other ranges, negative numbers and decimals.