How this random number generator works
A random number generator picks a value from a range where every possible number is equally likely. This tool lets you set the minimum and maximum (both inclusive), choose how many numbers to draw, and optionally require that they are unique or sorted.
Under the hood it uses your browser's Web Crypto API (crypto.getRandomValues) to gather random bytes. To turn those bytes into a number in your range without bias, it uses rejection sampling: it discards any raw value that falls outside the largest exact multiple of the range size, so no number is slightly more likely than the others. A naive modulo approach would quietly favour the lower part of the range — this avoids that.
Reference note: the output is cryptographically strong pseudorandomness suitable for giveaways, games and everyday use. If a browser does not expose the Web Crypto API, the tool falls back to Math.random, which is still fine for casual use but not for security-sensitive purposes.
Frequently asked questions
- How does this generate random numbers?
- It uses your browser's built-in
crypto.getRandomValuesto draw random bytes, then applies rejection sampling so every integer in your chosen range is equally likely. This avoids the modulo bias of a naive remainder approach. If a browser lacks the Web Crypto API, it falls back toMath.random. - Is it truly random?
- It is cryptographically strong pseudorandomness, suitable for giveaways, games and everyday use. Technically it comes from a CSPRNG seeded by the operating system rather than a physical source, but for practical purposes the output is unpredictable and unbiased.
- Can I get numbers without repeats?
- Yes. Tick the unique / no repeats box and every number drawn will be distinct — as long as you ask for no more numbers than the range can hold. You cannot draw 50 unique numbers between 1 and 10.
- Is the minimum and maximum inclusive?
- Yes. Both the minimum and the maximum are included in the range of possible results. A range of 1 to 6 can return any of 1, 2, 3, 4, 5 or 6.
- Is it good for a giveaway or raffle?
- Yes. Assign each entry a number, set the range to cover all entries, turn on no repeats if you are drawing several winners, and generate. The draw is unbiased and runs in front of you, so it is easy to do transparently.
- Does it store my data?
- No. Everything runs locally in your browser. Your inputs and the generated numbers are never sent to a server, and nothing is saved unless you copy the results yourself.