Skip to content
FindTool

    Random Number Generator

    Draw random integers or decimals in a range, with optional uniqueness and sorting.

    Random Number Generator tool

    Presets

    What this tool does

    It draws numbers from a range you define — one, or a hundred thousand — as whole numbers or with up to six decimal places. Switch on no repeats for lottery-style picks, sort the output, and choose how the numbers are separated so the result pastes cleanly into a spreadsheet, a SQL IN clause or a test fixture.

    The draws use crypto.getRandomValues(), so results are not reproducible from a seed. If you need the same sequence twice — a deterministic test, a replayable simulation — use a seeded PRNG in your own code.

    Common uses

    • Picking a winner, a reviewer or a pairing from a numbered list.
    • Six unique numbers from 1 to 49, or any other draw without replacement.
    • Rolling dice when the physical ones are in the other room.
    • Generating test data: ages, prices, latencies, coordinates.
    • Choosing a random port above 1024 or a random delay for a retry backoff.

    A short example

    Six unique whole numbers from 1 to 49, lowest first:

    3, 11, 17, 28, 34, 45

    Inclusive, exclusive, and where the bias hides

    Whole numbers include both ends: 1 to 6 can return 1 and can return 6, which is what people mean by a dice roll. Decimals include the minimum and exclude the maximum, because rounding a half-open interval is the only way to keep every value in it equally likely — with 0 to 1 at one decimal place, an inclusive maximum would make 0.0 and 1.0 half as likely as every other value.

    The subtler issue is how the integer is drawn. The obvious approach — a random 32-bit number modulo the range size — is biased whenever the range does not divide 232 evenly, making the low end of the range slightly more likely. This tool instead discards draws that land in the leftover block and takes another.

    Unique mode and the range you need

    Unique mode can only give you as many numbers as the range holds. Asking for 10 unique values between 1 and 5 is impossible, and this tool says so with the actual arithmetic rather than returning a short list or looping forever. For decimals, the number of distinct values depends on the precision: 0 to 1 at one decimal place holds only ten of them.

    Worth knowing

    Randomness looks less random than people expect. In 20 draws from 1 to 100 a repeat is more likely than not — about 87% — so seeing one is evidence of correct behaviour, not a bug. If your result must avoid repeats, say so with the no-repeats option.

    Frequently asked questions

    Is this fair enough to pick a competition winner?

    The draw is unbiased, but nobody watching can verify that — you could have pressed the button until you liked the answer. A public draw needs verifiability rather than better entropy: publish a commitment to the entrant list first, then derive the winner from a value nobody controls, such as NIST’s randomness beacon, which signs and publishes a fresh 512-bit value every 60 seconds.

    How do I do the same thing on the command line?

    shuf -i 1-100 -n 6 gives six distinct numbers wherever GNU coreutils is installed. Avoid bash’s $RANDOM for anything that matters: it is 15-bit, so it never exceeds 32767, and it is seeded predictably. In Python, random.randint() is a Mersenne Twister whose entire state can be recovered from 624 consecutive outputs — reach for secrets.randbelow() when the number is meant to be a secret.