Skip to content

Random number generator

Random numbers, dice rolls and coin flips.

What to generate
Type
Order

Result

–

History

    Spread of your draws

    Generate a few times and the bars fill in. Dashes mark where a perfectly even spread would land.

    Few draws look lumpy even when the source is fair. The gap shrinks as draws pile up (the law of large numbers). The "typical" figure is our rough guide: one standard deviation of the tallest bin's share.

    Numbers come from crypto.getRandomValues in your browser. The page does not send your numbers anywhere and keeps the history in memory only, until you close it. The site counts page views.

    How does the generator pick numbers?

    This random number generator picks each number from your range with equal odds, using crypto.getRandomValues(), the browser's cryptographically secure random source, instead of Math.random(). (The tumbling faces in the dice animation use Math.random() for looks only; the numbers you see afterward come from the secure source.) The operating system gathers unpredictable data from hardware and feeds a generator designed so that its output cannot be guessed from earlier results. The browser hands back 32 random bits at a time, and this page turns those bits into a number in your range.

    That last step is where many online generators go wrong. Turning 32 random bits into a number from 1 to 6 or 1 to 100 sounds like a one-line job, and the obvious line is slightly unfair.

    What is modulo bias?

    The obvious way to fit a random value into a range of n results is to divide by n and keep the remainder (the % operator). It works only when n divides the number of possible inputs exactly. It almost never does, so a few results get one extra chance.

    123456 42 full rows give each result 42 chances. The 4 leftover values (orange) give results 1 to 4 a 43rd chance.
    The 256 values of one byte, folded into six columns (results 1 to 6) with the remainder method.
    The skew from a plain remainder on one random byte (256 values)
    RangeFavored resultsChances for thoseChances for the rest
    1 to 6 first 4 results 43 of 256 (16.80%) 42 of 256 (16.41%)
    1 to 10 first 6 results 26 of 256 (10.16%) 25 of 256 (9.77%)
    1 to 100 first 56 results 3 of 256 (1.17%) 2 of 256 (0.78%)

    Source: calculated from 256 = quotient × range + remainder.

    With a full 32-bit word the skew shrinks to less than one part in a hundred million for a die, which is why a quick shortcut rarely shows up in a casual game. It still matters for anything that needs an exactly fair draw, and the fix is short. This page uses rejection sampling: it computes the largest block of values that divides evenly by the range, and if a draw lands in the leftover tail it throws it away and draws again. Every result then has exactly the same number of chances.

    How often a 32-bit draw is thrown away
    Range sizeShare of draws rejected
    6 9.3 × 10^-8%
    10 1.4 × 10^-7%
    100 2.2 × 10^-6%
    1,000 6.9 × 10^-6%
    1,000,000 2.3 × 10^-2%

    Source: calculated: 2^32 mod range, divided by 2^32.

    Ranges up to about 4.3 billion use one draw; larger ranges (up to 9 quadrillion) use 53 bits built from two draws, the most a JavaScript number can hold exactly.

    How are numbers without repeats chosen?

    With "No repeats" on, the generator shuffles instead of re-rolling. It lines up every number in your range and swaps random pairs, taking the first ones: this is the Fisher–Yates shuffle, which gives every possible set and order the same chance. For huge ranges where listing every number would be wasteful, it draws and skips any duplicate. Asking for more different numbers than the range contains is an error.

    What are the odds with dice?

    A single fair die is flat: every face has the same chance. Add a second one and the middle starts to win, because there are more ways to make a 7 than a 2.

    Two six-sided dice: every total
    TotalWays to roll itChance
    2 1 of 36 2.8%
    3 2 of 36 5.6%
    4 3 of 36 8.3%
    5 4 of 36 11.1%
    6 5 of 36 13.9%
    7 6 of 36 16.7%
    8 5 of 36 13.9%
    9 4 of 36 11.1%
    10 3 of 36 8.3%
    11 2 of 36 5.6%
    12 1 of 36 2.8%

    Source: calculated by counting all 36 outcomes.

    Single dice at a glance
    DieFacesAverage rollChance of one face
    d4 1 to 4 2.5 25%
    d6 1 to 6 3.5 16.7%
    d8 1 to 8 4.5 12.5%
    d10 1 to 10 5.5 10%
    d12 1 to 12 6.5 8.3%
    d20 1 to 20 10.5 5%
    d100 1 to 100 50.5 1%

    Source: calculated; the average of 1 to n is (n + 1) / 2.

    The d100 is the percentile die: in a tabletop game it is usually two ten-sided dice read as tens and ones. Here it is simply a number from 1 to 100.

    Does a coin flip have a memory?

    No. After five heads in a row the next flip is still 50-50. Believing otherwise is called the gambler's fallacy. Long streaks are rare, but each one is just a product of independent halves.

    Chance of a streak starting from your next flip
    StreakOddsChance
    1 in a row 1 in 2 5%
    2 in a row 1 in 4 25%
    3 in a row 1 in 8 13%
    5 in a row 1 in 32 3.1%
    10 in a row 1 in 1,024 0.098%
    20 in a row 1 in 1,048,576 0.000095%

    Source: calculated as one half to the power of the streak length.

    How do you pick six different numbers from 1 to 49?

    Six different numbers from 1 to 49

    Set From to 1, To to 49, How many to 6, tick "No repeats" and choose Low–high. The generator shuffles the 49 numbers, keeps the first six and sorts them for reading. There are 13,983,816 different sets of six, and each has the same chance. A past draw does not make any number more or less likely. If the numbers need to be non-negative whole values for another tool, our binary and hex converter shows them in other bases.

    Quick uses

    Pick who goes first (1 to the number of players), choose a raffle winner from a numbered list, or pick a random day from 1 to 365. For a tabletop character, roll 4d6 and ignore the lowest die yourself. For official lotteries and giveaways, follow the organizer's own rules for the draw.

    Common questions

    Is it really random?

    It is as unpredictable as your device's secure random source, which is the same one browsers use for encryption keys. Whether any number is "truly" random in a physical sense is a debate we leave to physicists; for games, draws and sampling it is more than good enough.

    Can I get the same number twice?

    Yes, unless "No repeats" is on. Repeats are a normal part of random draws, and two in a short list is common.

    Can I set a seed to repeat a sequence?

    No. A secure generator is not seeded by the user, so you cannot replay a sequence. If you need a repeatable list, use a seeded generator in code instead.

    Are the results stored or sent anywhere?

    The page does not send your numbers or settings to a server and does not write them to local storage. The history lives in the page's memory and disappears when you reload. The site does count page views. Need random characters instead of numbers? Use our password generator, and to check the odds of a result as a percentage, try the percentage calculator.

    Sources

    Last reviewed November 9, 2026.