Random Number
Generate fair random numbers in any range, one or many at a time, with or without repeats - powered by real cryptographic randomness.
Result
How it works
Pick a minimum and maximum, choose how many numbers you want, and decide whether repeats are
allowed. Every draw uses crypto.getRandomValues - the same secure random source
browsers use for cryptography - rather than Math.random. To keep it truly fair,
the code uses rejection sampling: if a raw random value falls in the small "leftover" region
that would skew a plain modulo, it is discarded and a new one drawn. The result is that every
number in your range comes up with exactly equal probability.
With or without duplicates
Leaving allow duplicates ticked draws each number independently, so a value can appear more than once - the right choice when you are simulating dice or coin tosses. Unticking it draws without replacement, guaranteeing every number in the result is unique. That is what you need for a lottery line, a raffle or picking distinct table numbers. When duplicates are off, the count cannot exceed the size of the range: you cannot pick 10 unique numbers from 1 to 5.
Everyday uses
- Lottery line - 1 to 59, six numbers, no duplicates.
- Dice roll - 1 to 6, one number, duplicates allowed.
- Random percentage - 0 to 100, one number.
- Pick a winner - 1 to the number of entrants, one number.
- Shuffle order - 1 to N, N numbers, no duplicates.
Need to draw from a list of names rather than numbers? Use the random picker. For quick yes-or-no decisions try the coin flip, or for tabletop games the dice roller handles d4 through d100.