Random Number Generator
Set the lowest and highest value and how many numbers you want, and get them right away. You can skip repeats, sort the list and use decimals.
52, 43, 69, 67, 100, 15, 28, 100, 58, 75
How the numbers are generated
Every number comes from crypto.getRandomValues, the system's random source. The generator discards the values that would skew the draw, so every number in the range has the same chance.
Both the lowest and the highest value can come up. From 1 to 6, for example, 1 and 6 are both possible.
What each option does
- Lowest and highest value: negative numbers are fine. The range must hold at least one possible number.
- No repeats: each number appears at most once, like balls drawn from a drum. The range needs at least as many numbers as the quantity you ask for.
- Decimals: draws values with up to 6 places between the lowest and the highest. Results keep every chosen place, such as 3.50.
- Limits: up to 1,000 numbers at a time, with values between -9,007,199,254,740,991 and 9,007,199,254,740,991.
What it is for
- Test data: IDs, quantities and values to fill tables and try out validation.
- Samples: pick positions or rows from a list, with the no-repeat option.
- Games and activities: simulate dice and tickets, such as 6 numbers from 1 to 60.
Random Number Generator FAQ
Randomness, repeats and the generator's limits.
Yes. The source is the system's cryptographic generator, and the code discards values that would favor certain numbers. There is no pattern to predict.
With no repeats, the range needs at least as many numbers as the quantity you ask for. From 1 to 5 you can only draw 5 different numbers. Widen the range or lower the quantity.
For passwords and tokens, use the site's password generator, which draws characters from the cryptographic generator and shows the strength in bits, or the UUID generator for long identifiers. This generator is meant for tests, samples and games.
Up to 1,000 numbers per run and up to 6 decimal places. Values must stay between -9,007,199,254,740,991 and 9,007,199,254,740,991, the largest integer JavaScript can hold without losing precision.