Random Number Generator with PIN Mode, Free and Private
Generate random integers or decimals in any range, unique or sorted, one or a thousand at a time, plus random PIN codes. Cryptographically random and never sent anywhere.
About the Random Number Generator
The Random Number Generator picks numbers at random inside any range you choose: one number or up to a thousand, whole numbers or decimals, all different or with repeats allowed, in the order drawn or sorted. A PIN mode produces random codes of four to twelve digits with their leading zeros. The numbers come from your browser's cryptographic random generator, so they are unpredictable and every value in the range is equally likely. Nothing is sent anywhere.
How to generate random numbers
Steps
- Set a Minimum and a Maximum. Both ends are included, so 1 to 6 behaves like a die.
- Choose How many numbers you want, from one to a thousand, and how many Decimal places, zero for whole numbers.
- Turn on Unique to avoid repeats, for example when drawing raffle winners, and Sorted to list the results in ascending order.
- Pick a Separator, one per line or comma-separated, press Generate, then Copy. Press Generate again for a fresh set.
PIN codes
Switch to PIN, choose the number of Digits and How many codes, and press Generate. Codes keep their leading zeros, so a four-digit PIN can be 0042. Every code from 0000 to 9999 is equally likely.
Privacy
Numbers are generated in your browser and never leave your device. There is no record of what was generated, so a PIN made here is known to you alone.
How the randomness works
Cryptographic source
The browser's crypto.getRandomValues draws from the operating system's random number generator, the same source used for encryption keys. It is not seeded from the clock and cannot be reproduced, unlike the simple generators built into many apps and spreadsheets.
No bias
Mapping a random machine word onto a range with a plain remainder slightly favours the low values. This tool uses rejection sampling instead: draws that would introduce that bias are thrown away and redrawn, so every value in your range has exactly the same chance.
Unique draws
With Unique on, the tool keeps drawing until it has the requested number of distinct values. If you ask for more unique values than the range holds, for example six different numbers between 1 and 5, it tells you rather than looping forever.
Common uses
- Rolling dice or drawing lots: 1 to 6, 1 to 20, or 1 to the number of entries.
- Picking raffle or giveaway winners from numbered entries, with Unique on.
- Choosing a random sample of rows, pages or participants.
- Generating test data, seeds and temporary PIN codes.
- Making decisions when a coin flip is not enough.
Limits
Up to 1000 values per click, up to 6 decimal places, PINs of 4 to 12 digits, and ranges up to a trillion in either direction. Decimal mode draws from the grid of values with the chosen number of places, so with two places and a range of 0 to 1 there are 101 possible results.
Related tools
For a secret that is harder to guess than digits, use the Password Generator. The UUID Generator produces random identifiers for software, and the Number List Calculator sums, averages and sorts the numbers you generate. Only need a PIN? Go to the PIN Generator.
Frequently asked questions
Are the numbers truly random?
They come from your browser's cryptographic random generator, which draws on the operating system's entropy, the same source used to create encryption keys. That is as close to unpredictable as software gets and far better than the clock-seeded generators built into many apps.
Is every number in the range equally likely?
Yes. Mapping a random machine word onto a range with a plain remainder slightly favours the smallest values. This generator uses rejection sampling, discarding and redrawing any value that would introduce that bias, so each value in your range has exactly the same probability.
Why can I not get six unique numbers between 1 and 5?
Because that range holds only five distinct values. With Unique switched on, the number of values you ask for cannot exceed the size of the range, and the page tells you how many values the range holds so you can adjust either the count or the range.
How do decimal places work?
The generator draws from the grid of values with the chosen number of places, so with two places between 0 and 1 the possible results are 0.00, 0.01 and so on up to 1.00, each equally likely. Up to six decimal places are supported.
Does anyone else see the PIN codes I generate?
No. Codes are generated in your browser and never transmitted, and the page keeps no history. A PIN produced here exists only on your screen until you copy it or generate another one.