Random Number Generator
Generate up to 100 random whole numbers between a minimum and a maximum, both included. Tick "Unique numbers only" when no number may repeat, as in a raffle draw. In Whole numbers mode, a decimal typed as the minimum or maximum loses the part after the decimal point. Switch to Decimals for random decimals with 1 to 10 decimal places.
How to use the Random Number Generator
- Enter your numbers in the Random Number Generator above.
- Press the Generate button to see the result.
- To try other numbers, change any value and press the button again.
How the numbers are drawn
Number = floor(Math.random() × (max − min + 1)) + min
Math.random() returns a pseudo-random number from 0 up to, but not including, 1. Multiplying by the size of the range and rounding down gives a whole number from 0 to max − min. Adding min moves it into your range. Decimals work the same way on a finer grid: with 2 decimal places, 0 to 1 is drawn as a whole number from 0 to 100 and divided by 100, so each of the 101 values has the same chance. A min or max with more decimals than you asked for moves inward, so no result falls outside your range. With "Unique numbers only" ticked, each draw picks from the numbers not drawn yet, so nothing repeats and every number keeps the same chance. The generator only keeps track of the numbers it has drawn, so 1 to 1,000,000,000,000 works as fast as 1 to 100.
Worked example
Set min 1, max 100 and count 5, then press Generate. You might get 47, 82, 13, 67 and 29, and a new set on every press. For a lottery-style draw of 6 numbers from 1 to 49, set min 1, max 49, count 6 and tick "Unique numbers only". For random prices from 0.50 to 9.99, pick Decimals, set min 0.50, max 9.99, count 3 and 2 decimal places. You might get 4.27, 0.93 and 8.06.
Frequently asked questions
Is this truly random?
No. It is pseudo-random, produced by your browser's Math.random() function. That is fine for games, raffles and sampling. For passwords, use the Password Generator, which draws from the browser's cryptographic random source.
Can I generate without duplicates?
Yes. Tick "Unique numbers only". The count cannot be larger than the number of whole numbers in the range, so asking for 100 unique numbers from 1 to 50 shows a message instead of a result. Ask for 50 and you get every number from 1 to 50 once, in random order.
Can it generate random decimals?
Yes. Pick Decimals and set the decimal places, from 1 to 10. Every result shows exactly that many places, so 2 places prints 0.50 and not 0.5. Min 0, max 1 and 2 places gives values from 0.00 to 1.00 in steps of 0.01. "Unique numbers only" works here too, and 0 to 1 at 2 places has 101 values to draw from.
Can I set a seed for reproducibility?
No. The generator uses Math.random(), which browsers do not let you seed, so every press of Generate gives a new result.