Random Number Generator
Random numbers with the digit length and count you set.
About Random Number Generator
Random Number Generator
Set a minimum and maximum length in digits, say how many numbers you want, and the tool returns them one per line. Ask for lengths 4 to 6 and 10 numbers, and you get ten numbers between 1000 and 999999. You can request up to 1,000 numbers per run, each up to 1,000 digits long.
How the numbers are made
The generator uses Python's secrets.SystemRandom, which reads from the operating system's cryptographic random source (/dev/urandom on Linux). Nobody can predict the next value from the previous ones, which you can't say for the default generators in many languages, such as Python's random module or JavaScript's Math.random(). Those use fast algorithms like the Mersenne Twister or xorshift, and someone who sees enough output can reconstruct their state.
For each number, the tool picks a length between your minimum and maximum, then picks a value with exactly that many digits.
Things to know
- No leading zeros: a 4-digit number falls between 1000 and 9999. The tool can't produce codes such as
0042. - Duplicates can happen: each number is drawn on its own. With short lengths and large counts, expect repeats. Ask for 100 two-digit numbers and you will see several.
- Lengths get equal weight: with a range of 1 to 3 digits, about a third of the results have one digit, even though only 9 of the 999 possible values do. If you need every value equally likely, use a single length.
Uses
- Test data: account numbers, order IDs or numeric fields of a fixed width.
- One-time PINs and verification codes for development and testing.
- Drawing winners, picking samples or assigning people to groups.
Our server generates the numbers and doesn't keep them. For real secrets, such as production keys, generate them on the system that will use them.