All tools › Math & Numbers

🎲 Random Number Generator

Generate a random number in any range.

Random, pseudorandom, and the difference

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.

Why randomness looks wrong

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.

Using random selection fairly

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.

Common questions

Can the result be predicted?
Not in any practical sense for casual use. Browser generators are not designed to resist a determined attacker, which is why cryptographic keys use a different, hardened source.
Is each number equally likely?
Yes, within the range you specify. The distribution is uniform.
Why did I get the same number twice?
Because uniform selection allows repeats. In a range of ten, drawing the same number twice in a row happens one time in ten — which feels wrong but is exactly correct.
More in Math & Numbers
%Percentage Calculator
Work out percentages quickly — what is X% of Y, and more.
🔺Percentage Change Calculator
Find the percent increase or decrease between two numbers.
🏛️Roman Numeral Converter
Convert numbers into Roman numerals.
💻Binary ↔ Decimal Converter
Convert between binary and decimal numbers.