How to generate random numbers
- Enter a Minimum and a Maximum. Both ends are included, so a range of 1 to 10 can return 1 and 10 as well as everything in between. Negative numbers work too, for example −50 to 50.
- Set How many numbers you want, from 1 to 10,000 per draw.
- Tick No repeats if each number may appear only once, and Sort the results to list them from smallest to largest.
- Click Generate, or press Enter in any of the boxes. Copy puts the result on your clipboard as a comma-separated list.
The Quick ranges buttons set a common range – a six-sided die, 1–10, 1–100 or 1–1000 – and draw one number straight away.
Good to know about the settings
- Whole numbers only. If you type decimals, the range is rounded inwards: a minimum of 1.5 becomes 2 and a maximum of 9.7 becomes 9.
- No repeats needs enough numbers. You can’t draw ten different numbers from 1 to 6; the tool tells you how many different numbers the range contains.
- Repeats turn up sooner than people expect. Draw 10 numbers from 1 to 100 with repeats allowed and there is about a 37% chance that at least two are the same. If a duplicate would spoil the result, tick No repeats.
- Very large ranges are fine. The range can be up to 9,007,199,254,740,992 numbers wide (2 to the power of 53), the limit up to which JavaScript represents every whole number exactly.
Examples
- Raffle with 250 tickets and 3 prizes: Minimum 1, Maximum 250, How many numbers 3, No repeats ticked. Each ticket has a 3 in 250 (1.2%) chance of being drawn, and no ticket can win twice.
- Lottery-style numbers: 6 numbers from 1 to 49 with No repeats and Sort the results. There are 13,983,816 possible combinations, and every one is exactly as likely as any other – including 1, 2, 3, 4, 5, 6.
- Spot-checking a spreadsheet: to review 20 of 500 rows, draw 20 numbers from 1 to 500 with No repeats and sorted results, then go through those row numbers from top to bottom.
- Two dice: set the range to 1–6 and How many numbers to 2, with repeats allowed. This is not the same as drawing one number from 2 to 12: with two real dice a total of 7 comes up 6 times in 36, but a total of 2 only once in 36. Drawing each die separately reproduces those odds.
How the randomness works
Many simple generators use JavaScript’s Math.random(). That is fine for games and animations, but browsers don’t promise that its output is unpredictable. This tool uses crypto.getRandomValues() instead, the browser’s cryptographically secure generator, which draws on the operating system’s entropy source – the same kind of randomness used to create encryption keys.
Turning a random value into a number in your range also needs care. The common shortcut “random value modulo the size of the range” is slightly biased: take a random byte (0–255) modulo 100, and the numbers 0–55 can each be reached in three ways while 56–99 can only be reached in two. The generator avoids this by discarding random values from the incomplete top section and drawing again, so every number in the range has exactly the same chance. When a no-repeat draw takes a large share of the range, it shuffles the range with the Fisher–Yates method and takes the first numbers, rather than redrawing duplicates over and over.
Ideas for using it
- Classrooms: pick a student by register number, choose which exercise to go through, or set a random page to read.
- Games: replace lost dice, decide turn order or roll for random events.
- Giveaways: number the entries – ticket numbers, comment positions or rows in a sign-up sheet – and draw the winners.
- Work and study: choose a random sample for a quality check, assign test cases or create test values.
To draw from a list of names rather than numbers, use the Random Name Picker, or the Spin the Wheel tool if you want the draw to be visible to an audience. For passwords, use the Password Generator, which is built for that job.
FAQ
Can I get the same numbers again later?
No. There is no seed to set, and every click is a new, independent draw, so a result can’t be reproduced. If others need to be able to check a draw, such as a public giveaway, record your screen or take a screenshot that shows the settings and the result.
Is a number that hasn’t come up for a while “due”?
No. Each draw is independent of the earlier ones, so a number that hasn’t appeared in the last 50 draws has exactly the same chance next time as every other number.
Can it generate decimal numbers?
Not directly, but you can scale the range. For a random value between 0 and 1 with two decimal places, draw a number from 0 to 100 and divide it by 100.
Can I use it for an official lottery?
The randomness is strong enough for any informal draw. Regulated lotteries and some prize promotions, however, have legal requirements about how winners are drawn and witnessed, so check the rules that apply to you.