RandomPick

Random numbers

Any range, any count, with or without repeats. Unbiased — including the modulo bias almost every simple generator has.

The bias almost every generator has

Producing a random number in a range looks like a one-liner and usually is written as one: take a random 32-bit integer, apply a modulo, add the lower bound. That result is not uniform. Unless your range divides exactly into 2³², the lowest values in the range get one extra chance each, because the top of the 32-bit space is truncated unevenly. For a range of 100 the skew is around one part in forty million — invisible in practice, and still wrong.

This generator discards any draw that falls in the uneven tail and redraws. It costs a fraction of a microsecond and it means the uniformity claim on this page is literally true rather than approximately true.

With and without replacement

Rolling a die ten times can give you the same number twice; drawing ten cards cannot. "No repeats" switches between those two models, and choosing the wrong one is the most common mistake with a number generator. If you are picking six numbers for a draw you want no repeats. If you are simulating ten dice you do not.

Questions

Are the numbers evenly distributed?
Yes, and getting this right takes slightly more than the obvious code. The naive approach takes a 32-bit random value and applies a modulo, which very slightly favours the low end of your range whenever the range does not divide evenly into 2³². This generator rejects and redraws values that would land in that biased tail. The effect is tiny, but the page claims fairness, so the claim is made true.
What does 'no repeats' do?
It draws without replacement, like pulling numbered balls out of a bag rather than rolling a die repeatedly. Ask for six unique numbers from 1–49 and you get six different ones. If you ask for more unique numbers than the range contains, the count is reduced to the size of the range rather than looping forever.
Can I use it to pick lottery numbers?
You can generate numbers in any range, and plenty of people use it that way. It will not improve your odds — every combination in a fair draw is equally likely, so a randomly chosen set is exactly as good and exactly as bad as any other. The one practical argument for random selection is that it avoids the popular patterns other people pick, which affects how a prize would be shared, not whether you win.
Is it suitable for research randomisation?
For informal use, yes. For a clinical trial or anything requiring an auditable allocation sequence, no — you need a documented, reproducible, seed-recorded procedure and a provider who will attest to it. This tool keeps no record of what it generated, which is a feature here and a disqualification there.