Skip to content

Random Number Generator

Generate one or many random numbers in any range, with options for integers vs decimals, with or without repeats, and sorted or unsorted output. Uses the browser's cryptographic random source, so the numbers are genuinely unpredictable — not the seeded pseudo-random output most generators produce.

Why Quality of Randomness Matters

Not all randomness is equal. Math.random() in JavaScript is a pseudo-random number generator: given the same internal state, it produces the same sequence. That's fine for shuffling a music playlist or picking a placeholder colour, but unacceptable for anything where predictability is a problem — password generation, security tokens, sample selection in research, drawing winners from a public contest.

crypto.getRandomValues() is the right primitive when randomness has to be unpredictable. It pulls from the operating system's entropy pool — keyboard timings, network packet jitter, hardware noise — which means the next number can't be derived from the previous one. This generator uses crypto.getRandomValues() for every output, even the playful uses, so the same code path serves both casual and serious work.

How It Works

For integer generation in a range, the tool uses rejection sampling against crypto.getRandomValues() to avoid the modulo-bias problem that simpler implementations have. (Naive code like crypto_random() % 100 produces slightly-biased output toward lower numbers when the underlying range isn't a multiple of 100; rejection sampling fixes this.) For decimal output, it generates a uniformly-distributed 64-bit float using the standard IEEE 754 mantissa trick. For the without repeats mode, the tool maintains a Set of already-issued values and re-draws until it gets a fresh one — which is fine when the range is comfortably larger than the count requested, and warned about when it isn't.

Need a single secure token instead of a number? The password generator and UUID generator use the same crypto primitive for token-shaped output rather than numbers.

Common Use Cases

Picking a winner from a numbered entry list — generate one integer in [1, N]. Selecting a random sample of rows from a CSV — generate K unique integers in the row-count range, no repeats. Generating test data that needs to look plausibly random rather than sequential. Picking a random colour seed for a generative design. Drawing random angles for a parametric animation. Rolling dice for tabletop games when you don't have physical dice handy.

How We Compare

Random.org pulls from atmospheric noise and is the gold standard for verifiable randomness — they publish their entropy methodology and offer signed certificates of randomness for high-stakes draws. For most use cases, crypto.getRandomValues() is already strong enough, and a local browser tool avoids the third-party dependency and the rate limit Random.org imposes on free use. Built-in spreadsheet RAND() functions use weaker pseudo-random sources and are not suitable for security-sensitive work. This generator runs locally and uses the same crypto primitive your browser uses for HTTPS.

Frequently Asked Questions

How random are the numbers?+
The tool uses the browser's crypto.getRandomValues() API when available, which produces cryptographically strong random numbers. This is suitable for most use cases but not recommended for cryptographic key generation.
What's the maximum range?+
The tool supports numbers from -9,999,999,999 to 9,999,999,999. For integers, you can generate up to 10,000 numbers at once. For unique-only mode, quantity cannot exceed the range size.
Can I generate decimal numbers?+
Yes. Toggle decimals mode and choose how many decimal places (1-10). Decimal mode always allows duplicates since floating-point numbers have effectively infinite range.
Can the same number appear twice?+
By default yes. Toggle 'unique only' to ensure every generated number is different. Useful for lottery draws, raffle tickets, or picking distinct items.
Is the random number generator cryptographically secure?+
Yes — the tool uses window.crypto.getRandomValues, which produces cryptographically-secure pseudo-random numbers suitable for tokens, keys, and game-shuffles where bias would matter.
Can I generate without replacement?+
Yes — the "no duplicates" toggle ensures each number in a batch is unique. Useful for lottery picks, randomised draws, and shuffling sequences.
What range can I generate?+
Any integer range fitting in a JavaScript safe integer (±2^53). For larger numbers, switch to BigInt mode which supports arbitrary-precision integers.
How is this different from Math.random()?+
Math.random() is NOT cryptographically secure — its output is predictable from prior outputs. crypto.getRandomValues is secure but slightly slower. The tool always uses the secure variant; the difference is imperceptible at human scales.

📖 Learn More

Related Guide Random Number Generator Guide →

Built by Derek Giordano · Part of Ultimate Design Tools

Privacy Policy · Terms of Service