Skip to content

Random Number Generator

Cryptographically secure random integers, with range, count and uniqueness.

Runs in your browser

Set the range, the count and whether you need unique values. We use the Web Crypto API (window.crypto.getRandomValues) and rejection-sample to remove modulo bias - no Math.random.

How to use it

  1. Pick a range and count

    Min, max (inclusive) and how many numbers.

  2. Tune uniqueness and sort

    Tick 'unique' when you need a draw without replacement; tick 'sort' to get values in ascending order.

  3. Regenerate or copy

    The regenerate button rolls again. Copy returns the values one per line.

What is it?

A random number generator produces unpredictable integers within a chosen range. The crucial detail is the source of randomness: a cryptographic RNG (CSPRNG) gives outputs an observer cannot predict even with full knowledge of previous values. Math.random is fine for game animation but insufficient for any draw where fairness matters.

When to use it

Rolling dice for a board game on a phone, picking a winner from a list of N entries, generating sample data for testing, lottery picks, draft order, name-tag numbers, OTP generation when you can't reach a real secret.

Common mistakes

Using Math.random for anything fairness-sensitive - it's predictable enough for adversaries. Generating 'unique' numbers from a too-small range (you need range >= count). And confusing 'cryptographically random' with 'uniformly random across all platforms' - both are true here, but the second is what determines fairness.

FAQ

Are the numbers truly random?
They're cryptographically pseudo-random. The browser's CSPRNG is seeded by the OS and indistinguishable from true random for any practical purpose - the same primitive that powers TLS.

More in this category