Skip to content
Utilboxes

Random Number Generator

Set the lowest and highest numbers, choose how many you want and turn off duplicates if each must be unique, as in a lottery draw, then copy the results. Numbers come from your browser's cryptographic random generator, with rejection sampling so every value is equally likely. Both endpoints can be drawn.

Runs entirely in your browser

Updated

How to use the Random Number Generator

  1. 1Set the lowest and highest numbers in your range.
  2. 2Choose how many numbers you want.
  3. 3Turn off duplicates if each number must be unique, as for a lottery draw.
  4. 4Generate, then copy the results.

How it works

Numbers come from crypto.getRandomValues(), the same cryptographic source used for passwords, rather than Math.random(). For a raffle or a decision that matters, that difference is worth having.

Getting a uniform distribution from random bytes takes a little care. Simply taking the remainder of a random number leaves the lower part of the range very slightly more likely — imperceptible for small ranges, but a real bias. Rejection sampling avoids it by discarding values that fall outside a clean multiple of the range.

With duplicates disabled, the tool draws without replacement, which is what a lottery or a prize draw actually does. It also checks that the range is large enough to supply the count you asked for.

Tips and common mistakes

  • Turn off duplicates for raffles and draws, so no number can win twice.
  • Number your entries before drawing, and publish the range you will use, so the draw is easy to check.
  • Record the screen during a public draw if people will want to see that it was fair.
  • For shuffling a list of names, Sort Lines can put the lines in a random order.

Frequently asked questions

Is this truly random?
It uses the browser's cryptographically secure generator, seeded from operating system entropy. It is not quantum randomness, but it is unpredictable by any practical means.
Can I stop numbers repeating?
Yes. Turn off duplicates and the numbers are drawn without replacement, exactly as in a lottery draw.
Can I use this for a prize draw?
The randomness is sound. For anything with legal or contractual weight, keep a record of the entrant list and the result, since the draw itself leaves no audit trail.
Are the endpoints included?
Yes. Both the minimum and the maximum can be drawn.
How do I pick a random winner from a list of names?
Number the names from 1 upwards, then draw one number in that range. The name with that number wins.
Can I use it as a dice roller?
Yes. Set the range from 1 to 6, allow repeats, and generate as many rolls as you need.
Can it pick lottery numbers?
It can draw, for example, six different numbers from 1 to 49. Every combination is equally likely, so no generator can improve your chances.

Guides