Random Number Generator

Set a minimum, set a maximum, choose how many numbers you want, and hit Generate. You can allow repeats or force every number to be different, and copy the whole batch to your clipboard when you are done.

Put this calculator on your website for free

Copy one snippet and give your visitors a working Random Number Generator.

How this random number generator works

You give us a range and a count, and we draw whole numbers where every value in the range has exactly the same chance of coming up. Ask for one number and you get a clean pick. Ask for twenty and you get a grid you can copy in one click. The share link remembers your settings (range, count, repeats) but never the numbers themselves, so every visit is a fresh draw.

The formula

n = floor(random() × (max - min + 1)) + min

Here random() is a decimal from 0 up to (but never reaching) 1, min and max are the ends of your range, and floor rounds down to a whole number. The "+ 1" matters: it makes the range inclusive on both ends, so the maximum can actually be drawn. Skip it (a classic bug) and your top number never appears.

Worked example

Say your range is 1 to 10 and the generator produces random() = 0.4237. Then n = floor(0.4237 × 10) + 1 = floor(4.237) + 1 = 4 + 1 = 5. Every slice of the 0-to-1 line maps to exactly one of the ten numbers, and every slice is the same width, so each number has a 10% chance.

What "random" actually means here

Your browser does not flip a real coin. It runs an algorithm (a pseudorandom generator) that starts from a hidden seed and produces a stream of numbers that passes every statistical test you would care to throw at it, while being completely deterministic underneath. For picking a winner among friends, shuffling chores, sampling a class, or settling who buys lunch, that is more than good enough. It is not good enough for cryptography, and it leaves no audit trail for a regulated lottery. When the stakes demand randomness you can defend, use physical dice or a service like random.org, which draws from atmospheric noise and publishes verification records.

What people use it for

The classics: drawing raffle and giveaway winners (number the entries, draw with repeats off), picking a random sample for a survey or a taste test, breaking a tie or a stalemate ("odd I choose, even you choose"), assigning presentation order, and teaching probability, where generating 100 numbers and tallying them beats any lecture on the law of large numbers. If your game just needs a d6 or a d20, our dice roller is the faster tool, and if you want to know the odds behind your draws, the probability calculator picks up where this page leaves off.

How the no-repeat draw works

When you turn repeats off, we do not draw and re-draw until we get lucky. For normal ranges we use the Fisher-Yates shuffle: picture every number in your range as a card in a deck. We shuffle the deck fairly, one card at a time, then deal your numbers from the top. Every possible hand is equally likely, and it finishes in one pass no matter how unlucky you are. For enormous ranges (over 100,000 values) building the whole deck would be wasteful, so we switch to drawing normally and quietly discarding any duplicate, which is nearly instant when the range dwarfs the count. Either way you get distinct numbers with equal odds; the only difference is what happens under the hood.

Frequently asked questions

Can the random number generator repeat numbers?

Yes, by default it can, because every draw is independent, just like rolling a die twice can land on the same face. If you want every number to be different, switch the repeats option to No and the tool will deal each number at most once.

Is this truly random?

No, it is pseudorandom. Your browser generates numbers with an algorithm that is statistically excellent but ultimately deterministic. That is perfectly fine for picking a raffle winner among friends, choosing who goes first, or classroom sampling. It is not appropriate for cryptography or a lottery that needs an audit trail.

How do I pick a random number between 1 and 100?

Enter 1 as the minimum, 100 as the maximum, leave the count at 1, and press Generate. Every whole number from 1 to 100 has exactly the same 1 in 100 chance of coming up.

Can I generate negative random numbers?

Yes. Both the minimum and maximum accept negative values, so a range like -50 to 50 works fine. The only rule is that the minimum must not be larger than the maximum.

Why does it say my range is too small?

Because you asked for more unique numbers than the range contains. With repeats turned off, a range of 1 to 5 holds only 5 possible values, so it cannot supply 10 different numbers. Widen the range, lower the count, or allow repeats.

Can I use this for a raffle or giveaway?

For an informal raffle, absolutely: number your entries, set the range to match, and generate a winner. Turn repeats off if you are drawing several winners so nobody wins twice. For a regulated lottery or anything with legal stakes, use a certified draw method instead, since this tool has no audit trail.

Related calculators