Secure Random Number Generator
Generate cryptographically secure random integers offline using the Web Crypto API. Customize range, duplicates, sorting, and formatting.
⚙️ Generator Settings
📋 Generated Results
Cryptographically Secure vs. Standard Random Number Generators
Most standard coding environments use algorithms like the linear congruential generator or xorshift for their random functions (such as `Math.random()` in JavaScript). These are called Pseudo-Random Number Generators (PRNGs). While they are fast, they are completely deterministic: if someone discovers the internal state or "seed" of the generator, they can predict every single number that will be generated next.
This tool uses the browser's native Web Crypto API (`window.crypto.getRandomValues`), which implements a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG). A CSPRNG integrates high-quality entropy collected directly from the host operating system (such as thermal noise, keyboard timings, and system interruptions). This makes it mathematically impossible to guess or predict the output sequence, which is essential for passwords, security tokens, crypto keys, and fair gaming.
How We Eliminate Modulo Bias
A common mistake when scaling a random integer to a specific range (e.g., between `min` and `max`) is using the simple modulo operation: `min + (randomInt % range)`. If the range does not divide the maximum value of the random generator evenly, some numbers will have a slightly higher chance of appearing than others. This is known as modulo bias.
Our secure random number generator automatically eliminates modulo bias using a rejection sampling technique. If a generated value falls within the biased remainder at the top of the 32-bit integer range, the number is securely discarded and a new one is requested, guaranteeing a perfectly uniform probability distribution across your entire selected range.
Frequently Asked Questions
This generator uses the Web Crypto API's window.crypto.getRandomValues method. Unlike standard Math.random(), which uses a predictable pseudo-random algorithm, the Web Crypto API draws entropy directly from your operating system's hardware RNG. This ensures the output is cryptographically secure and suitable for security-sensitive tasks.
No. The Secure Random Number Generator operates entirely client-side inside your browser. No data, inputs, or generated numbers are ever transmitted to any external server or API, meaning it works 100% offline and is completely private.
You can choose whether or not to allow duplicate numbers in your results. If you disable duplicates, the generator will guarantee that every number in the output is unique. Please note that if duplicates are disabled, the quantity requested must not exceed the total size of the range.