Random Number Generator 1–20

Generate a number from 1 to 20, with each number at an equal 5% chance: the same odds as a fair twenty-sided die.

1 to 20

More options

History (this visit only)

Nothing yet. Results appear here.

    Quick answer: Each number from 1 to 20 has a 1 in 20 (5%) chance. That matches a fair d20, so a 20 comes up 5% of the time. Rolling twice and keeping the higher result (advantage) gives at least one 20 9.75% of the time.

    Examples

    You want to…Setting
    Stand-in for a d20 roll1 number
    Pick one student from a class of 201 number
    Roll with advantage2 numbers, then keep the higher
    Choose 4 different stations out of 204 numbers, no repeats

    How to use it

    1. Press Generate for one number from 1 to 20.
    2. For several numbers, open More options, set How many numbers (up to 20 with No repeats) and choose an order.
    3. Change Min or Max at any time to use a different range.
    4. Copy the results, or press Present to show them full screen.

    Good uses for 1–20

    • Tabletop games, when the dice are missing. A full dice roller with modifiers and advantage is on the way.
    • Class of up to 20: give each pupil a number and draw without repeats so everyone gets a turn.
    • Quiz rounds: choose which of 20 prepared questions to ask next.

    Worth knowing

    • With 5 draws from 1–20 (repeats allowed), the chance that at least two match is about 41.9%.
    • Every number is equally likely, so a run of low numbers is just chance. Past results do not change the next one.

    How the numbers are chosen

    Your browser’s cryptographic random source (crypto.getRandomValues) supplies 32-bit random values. We map them onto your range with rejection sampling: any value that would make some numbers slightly more likely than others is thrown away and redrawn. The common shortcut (value % range) skips this step and adds a small bias. For No repeats we use a partial Fisher–Yates shuffle, which draws only as many numbers as you ask for, even from a huge range.

    The result is fixed before the rolling animation starts. The animation is decoration and never changes the outcome. Everything runs on your device: nothing you enter or generate is sent to us. More on how it works.

    Limits

    • Whole numbers only, between about −9 quadrillion and +9 quadrillion (JavaScript’s exact integer range), with a range width of up to 253.
    • Up to 10,000 numbers per click. With No repeats, you can’t ask for more numbers than the range contains.
    • Fine for games, classrooms and everyday choices. Not certified for lotteries, regulated prize draws or generating security keys.

    Need a different range? Use the main random number generator.

    Questions

    Is this the same as rolling a d20?

    The odds are identical: 1 to 20, 5% each. It does not do dice notation or modifiers yet; add those yourself for now.

    Can I roll several at once?

    Yes. Set How many numbers under More options. The sum is shown under the results.

    Are 1 and 20 included?

    Yes. Both ends of the range are included.

    References

    1. W3C. Web Cryptography Level 2: Crypto.getRandomValues(). World Wide Web Consortium specification.
    2. Daniel Lemire. Fast Random Integer Generation in an Interval. ACM Transactions on Modeling and Computer Simulation 29(1), 2019 (discusses modulo bias and rejection).
    3. Richard Durstenfeld. Algorithm 235: Random permutation. Communications of the ACM 7(7), 1964.

    Page reviewed 30 November 2026.