Skip to main content
UtilityStack

Random Number Generator — secure & unbiased

Pick any min/max range and how many values you want. Numbers are generated using the browser's CSPRNG with proper rejection sampling — uniformly distributed and unbiased.

    How is randomness generated?

    The numbers come from your browser's cryptographically secure pseudo-random number generator (crypto.getRandomValues). It draws 32-bit unsigned integers from the OS's entropy source, then this tool applies rejection sampling to map them to your range without bias — naive 'modulo by range' produces small but measurable bias for non-power-of-2 ranges, which we explicitly avoid.

    For values you genuinely need to be 'random' for security (lottery picks, verification codes, raffle winners), this is the right approach. For statistical sampling or simulation that needs reproducibility, you'd want a seeded PRNG instead — those are deterministic given a seed, which trades unpredictability for repeatability.

    How to use this tool

    1. Set the min and max for your range. Both are inclusive — min=1, max=10 produces values from 1 through 10.
    2. Pick how many numbers to generate (1 to 1000). Tick 'Unique values' if no number should appear twice; the tool prevents you from asking for more uniques than the range can provide.
    3. Click Regenerate for a new draw any time. Tick 'Sort ascending' to see them in order. Click Copy to grab the list (one number per line) for your spreadsheet, raffle, or test fixture.

    Frequently asked questions

    Are the numbers truly random?

    They are cryptographically pseudo-random — secure for unguessable use cases (passwords, raffle picks, verification codes). For 'true' randomness from physical entropy (atmospheric noise, radioactive decay), services like random.org use external entropy sources. The CSPRNG in your browser is sufficient for everything except the most paranoid security requirements.

    Why insist on rejection sampling?

    If you take a 32-bit random integer and apply 'value % range', you get bias when range doesn't divide 2^32 evenly. The bias is small (parts per million for typical ranges) but real. Rejection sampling — discarding values that would map unfairly and re-rolling — eliminates the bias entirely.

    What's the largest range you support?

    Min and max can be any integer. The 'unique values' mode is limited to ranges that fit in memory (millions of values), but for typical use cases (1-100, 1-10000, etc.) there's no practical limit.

    Can I get reproducible random numbers?

    No — this tool uses the system CSPRNG which is non-deterministic. For reproducible random sequences (testing, simulation), use a seeded PRNG library like seedrandom in Node or numpy.random in Python.

    What about cryptographic key generation?

    For actual cryptographic secrets (API keys, JWT secrets, encryption keys), use a tool that produces longer random strings — base64-encoded bytes, for example, or pure UUIDs. This generator outputs short numeric ranges; use the password generator or UUID generator for cryptographic-grade secrets.

    Common use cases

    Where unbiased random numbers actually matter.

    Raffle and giveaway picks

    Number every entry, set range to 1..N entries, generate one (or several for multi-prize giveaways). The audit trail is the screenshot of the generator with its range and result.

    Lottery number picks

    Tick 'Unique values', set count to 6 (Loto) or 5+1 (EuroMillions main + bonus draws separately), set range to the official limits. Done.

    Picking a sample of users

    Need to QA-test 50 random users out of 100,000? Generate 50 unique numbers between 1 and 100,000, then pull those rows from your database.

    Random test data

    Quick prototype needs 200 random IDs, ages, or scores? Generate the column in seconds instead of writing a one-off script.

    Tips and shortcuts

    Habits that prevent random-number gotchas.

    Inclusive ranges, both ends

    min=1, max=10 means 'between 1 and 10 inclusive'. Off-by-one errors are common — always verify by setting count=1000, sort, and confirming the smallest value equals min and largest equals max.

    Tick 'Unique' when sampling

    If you're picking 5 raffle winners from 100 entries, you almost certainly want unique. Without it, you can pick the same entry twice — usually not what raffles want.

    Document your method for fair raffles

    Public raffles benefit from a documented method. Stating 'numbers generated by randomnum.app at 14:35 UTC, range 1-N, count P' is enough for most jurisdictions; some require a notary.

    For production code, use a real RNG library

    This tool is for one-off picks. In code, use crypto.getRandomValues() (browser/Node) or your language's secrets module (Python). Don't rely on Math.random() for anything that matters.

    Herramientas relacionadas