Generate a cryptographically secure random whole number within any range.
A cryptographically secure random value (crypto.getRandomValues) is mapped into your 1–100 range, so results aren't predictable.
Computer-based random number generators typically fall into two categories: pseudorandom number generators (PRNGs), which use a deterministic algorithm seeded with an initial value, and true random number generators (TRNGs), which draw from physical entropy sources like hardware noise. Most everyday tools, including browser-based generators, use cryptographically secure PRNGs suitable for non-security-critical purposes like games, sampling, or draws.
This formula maps a uniformly distributed decimal between 0 and 1 onto a specific integer range, ensuring every integer in the range has an equal probability of being selected.
| Use case | Typical setup |
|---|---|
| Dice roll simulation | Integer between 1 and 6 |
| Raffle/giveaway winner | Integer between 1 and total entries |
| Sampling from a dataset | Unique random integers within a range, no repeats |
| Lottery number generation | Multiple unique integers within a defined range |
Is this type of random number generator suitable for gambling or lotteries? Regulated gambling and lottery systems require certified, audited random number generators — general-purpose tools like this are best suited for casual, non-regulated use like games or informal drawings.
Can the same number be generated twice in a row? With repetition enabled, yes — each generation is an independent event, so repeats are statistically expected over many draws.
What's the difference between pseudorandom and truly random? Pseudorandom numbers are produced by a deterministic algorithm that appears random but is technically reproducible from its seed, while true randomness draws from unpredictable physical processes.
Why use crypto.getRandomValues() instead of Math.random()? Math.random() is a fast, non-cryptographic PRNG that can be predictable in some implementations, while crypto.getRandomValues() draws from a cryptographically secure source, making it more suitable when unpredictability actually matters.
How can I generate a list of unique random numbers without duplicates? Use the "without repetition" mode, which removes each generated number from the available pool before the next draw, guaranteeing no repeats within that batch.
Does the range size affect randomness quality? No — a well-implemented generator maintains uniform probability across any range size, whether it's 1–6 or 1–1,000,000.
Can I use this to simulate multiple dice or draw several numbers at once? Yes — generating several independent random integers in sequence (with repetition allowed) accurately simulates multiple dice rolls or similar repeated random events.
Generating a number between 1 and 100 gives each of the 100 possible outcomes an equal, independent chance — useful for anything from picking a raffle winner to choosing a random starting point for a game.
Pseudo-random: Numbers generated by an algorithm that appear random but are technically deterministic and potentially predictable.
Cryptographically secure: A random number source designed to be unpredictable, suitable for security- or fairness-sensitive applications.