Random Number Generator

Pick random numbers in any range, with or without repeats.

Press Generate to draw a number.

History

Recent results appear here. Click one to copy it.

How the random number generator works

Every number comes from the Web Crypto API (crypto.getRandomValues), the same source browsers use for encryption keys. The generator runs in the browser and sends nothing to a server. The last results stay in a short history on this device.

A common shortcut takes a random value and fits the value to the range with the modulo operator. The shortcut favours low numbers whenever the range does not divide evenly into the random source. This tool uses rejection sampling instead: values above the largest even multiple of the range get discarded and drawn again, so every number in the range has the same chance.

Unique numbers and decimals

With Unique only switched on, each number appears once, the same as drawing raffle tickets from a hat. The count has to fit the range, so 1 to 10 holds ten unique whole numbers at most. Decimal mode draws from a fixed number of decimal places: 0 to 1 with two places picks evenly from 0.00, 0.01 and so on up to 1.00.

Common uses

People use random numbers to pick a raffle or giveaway winner from a numbered list, run a lottery-style draw such as 6 from 49, choose a seat number in class, or select rows for a spot check in a spreadsheet.