Random number and string generator
Generate random numbers in a range without duplicates, or random strings from letters, digits and symbols, using crypto.getRandomValues.
How to generate random numbers and strings
- 1
Pick numbers or a string
Switch between a range of numbers, integer or decimal, and a random string built from the character types you choose.
- 2
Set the range or the alphabet
For numbers, set the minimum, maximum and whether duplicates are allowed. For strings, turn character types on or off, or paste a custom alphabet of your own.
- 3
Generate and copy the result
Up to 10,000 values appear at once, one per line, ready to copy straight to the clipboard.
Why crypto.getRandomValues instead of Math.random
JavaScript's Math.random is fast but was never meant to resist prediction. A handful of outputs from some engines is enough to reconstruct its internal state and predict every value that follows. crypto.getRandomValues draws from the operating system's cryptographically secure generator instead, the same source browsers use to create encryption keys, so nothing about the sequence can be guessed from watching it. This tool uses that source everywhere, including for shuffling a list when duplicates are turned off.
Modulo bias, and how rejection sampling removes it
The naive way to turn a random 32-bit number into "a value from 1 to 100" is to take it modulo 100, but that quietly favours the low end of the range: 2^32 does not divide evenly by 100, so the leftover values that don't fit a full multiple all round down to the same handful of results. This tool instead throws away any draw that falls in that uneven remainder and tries again, which is called rejection sampling, so every number in the requested range has exactly the same probability of appearing.
Every value is generated in this tab
Numbers and strings are produced entirely in your browser using the Web Crypto API. Nothing you generate is sent to a server or written to browser storage, and the shareable link only ever encodes your settings, never the actual values, since a predictable link would defeat the point of a random draw.
Frequently asked questions
Why is crypto.getRandomValues better than Math.random?
Math.random is optimised for speed, not unpredictability, and its output has been shown to be reconstructible from a small sample of results in several JavaScript engines. crypto.getRandomValues draws from the operating system's cryptographically secure random number generator, which offers no such shortcut.
How does "no duplicates" work for large ranges?
For ranges up to five million possible values, this tool shuffles the full list with a Fisher-Yates shuffle and takes as many as you asked for. Above that, it draws values one at a time and keeps only new ones, which stays fast because collisions are rare when you are requesting far fewer values than the range contains.
What is modulo bias, and why isn't this just a % range?
Reducing a random 32-bit number with a plain remainder operation makes the low end of your range very slightly more likely to appear, because 2^32 is not an exact multiple of most range sizes. This tool rejects and redraws the small slice of values that would cause that skew, so every outcome in your range is equally likely.
Can I use the result as a password?
A random string generated here with a large alphabet and enough length is just as strong as a password from a dedicated generator. If you specifically want entropy figures, a strength score, or a passphrase, the password generator is built for that instead.
How many numbers or strings can I generate at once?
Up to 10,000 in a single batch, whether you are generating numbers or strings. That comfortably covers raffle draws, test data and sampling use cases without needing to run the tool repeatedly.
Do the generated values ever leave my browser?
No. Every number and every character is produced locally using the Web Crypto API, and nothing is uploaded anywhere. Copying to the clipboard is the only way a value leaves the page, and that is entirely under your control.
Why doesn't the shareable link include the actual numbers?
The link only reproduces your settings (the range, the count, whether duplicates are allowed), never the values themselves. A link that could replay the same "random" numbers on demand would make them predictable, which defeats the purpose of generating them this way.