Generate a random number in any range.
This generator uses your browser's built-in random number source. For picking a name, choosing a winner, or settling an argument, that is entirely adequate.
Strictly speaking it is pseudorandom: an algorithm produces a sequence that passes statistical tests for randomness but is fully determined by an internal state. True randomness requires a physical source — atmospheric noise, radioactive decay, thermal noise in a circuit — which is what dedicated hardware generators use.
The distinction only matters for cryptography, where predictability is fatal. For lotteries, sampling, and games, a good pseudorandom generator is indistinguishable from the real thing.
People are poor judges of what random sequences look like. Genuine randomness produces clusters and streaks far more often than intuition suggests. Twenty coin flips containing a run of five heads is unremarkable; a sequence that alternates neatly is actually the suspicious one.
This misreading has a name — the gambler's fallacy — and it is the belief that a run of one outcome makes the other "due". Each flip is independent. A coin that has landed heads nine times running is still exactly fifty-fifty on the tenth, assuming the coin is fair.
The birthday problem is the same intuition failing in the other direction: in a group of just 23 people, there is better than an even chance that two share a birthday. Collisions in random data are far more common than expected.
If you are running a prize draw, the process matters as much as the mathematics. Announce the method before drawing, draw once rather than repeatedly until you like the result, and where the stakes justify it, have someone independent observe.
For sampling — picking respondents, selecting items for quality checks — random selection is what makes the sample representative. Convenience selection introduces bias that no amount of subsequent analysis can remove.
When you need selection without repeats, draw and remove rather than drawing repeatedly and discarding duplicates. The latter is slower and, in some implementations, subtly biased.