Skip to content

Random Number Generator

Pick fair random numbers between any two numbers, with or without repeats. Advanced adds lottery lines, dice, coins, a name picker and teams.

More options
What do you want to pick?
Repeats
Type of number
Only

Separate with commas. Use a dash for a range, like 20-25.

Order of results
Copy results with

Advanced also does several numbers, no repeats, decimals, lottery lines, dice, coin flips, name picking and teams.

Your number
Your last draws (kept on this device)

    Nothing yet. Each draw you make is listed here.

    How your random number is picked

    Random bits from your device, with the unfair top end thrown away, so every answer is equally likely.

    1. 1

      Count the choices

      100 − 1 + 1= 100 choices

    2. 2

      Draw random bits

      32 bits from cryptor = 2,718,281,828

    3. 3

      Drop the unfair top

      cut-off= 4,294,967,200r is under: kept

    4. 4

      Map to your range

      r mod 100 = 2828 + 1= 29

    Read more: the formula, a worked example, lottery odds and notes

    A fair random number generator gives every allowed answer exactly the same chance. This one uses your device's secure random source (crypto.getRandomValues, the same one used for passwords and encryption), which gives random whole numbers from 0 to 4,294,967,295 (that is 232 − 1). Nothing is sent to a server.

    The catch: 4,294,967,296 values don't split evenly into most ranges. If you just took "random value mod 100", the numbers 1 to 96 would each come up very slightly more often than 97 to 100. To stop that, the top sliver of values (the leftover that doesn't make a full set) is thrown away and a new value is drawn. This is called rejection sampling, and it makes every answer exactly equally likely.

    The formula

    choices = highest − lowest + 1 (minus any left out)
    cut-off = 4,294,967,296 − (4,294,967,296 mod choices)
    draw r; if r ≥ cut-off, draw again
    number = lowest + (r mod choices)

    Worked example

    For a number from 1 to 100 there are 100 − 1 + 1 = 100 choices. 4,294,967,296 mod 100 = 96, so the cut-off is 4,294,967,296 − 96 = 4,294,967,200. Say your device gives r = 2,718,281,828. That is under the cut-off, so it is kept. 2,718,281,828 mod 100 = 28, and 1 + 28 = 29. Only 96 of the 4,294,967,296 possible values (about 0.0000022%) are ever thrown away, so a redraw is very rare.

    No repeats, decimals and numbers left out

    • No repeats: each pick is made from the numbers not yet drawn, so the second pick from 1 to 100 is a fair choice from the 99 that are left. This is the same as drawing balls from a bag without putting them back.
    • Decimals: with 2 decimal places, 0 to 1 becomes the 101 values 0.00, 0.01 … 1.00, and one is picked fairly.
    • Left-out numbers and even or odd only: those numbers are taken out of the list of choices before the draw, so the rest keep equal chances.
    • Very big ranges (over about 4.3 billion choices) use two random values joined into a 53-bit number, with the same cut-off rule.
    • Shuffles and teams use the Fisher–Yates shuffle: the last place is filled by a fair pick from everyone, the next place from everyone left, and so on. Teams are then dealt out in turn, so sizes differ by at most one.

    Odds of matching every ball

    The odds of one line matching all the main balls are 1 in (balls choose picked), times (bonus balls choose bonus picked) if there is a bonus drum. For 6 from 49 that is 49 × 48 × 47 × 46 × 45 × 44 ÷ (6 × 5 × 4 × 3 × 2 × 1) = 13,983,816.

    FormatOdds of matching all, 1 in
    6 from 4913,983,816
    6 from 458,145,060
    6 from 5945,057,474
    7 from 356,724,520
    5 from 69 + 1 from 26292,201,338
    5 from 70 + 1 from 24290,472,336
    5 from 50 + 2 from 12139,838,160
    5 from 47 + 1 from 2741,416,353

    Every combination is equally likely, so "lucky" or "due" numbers don't exist: 1, 2, 3, 4, 5, 6 has exactly the same chance as any other line. Picking numbers others avoid (for example, above 31, which rules out birthdays) doesn't change your odds of winning, but can mean sharing a prize with fewer people. This tool is for fun, games, classrooms and fair draws; it is not connected to any lottery. For legally regulated draws, follow the rules of the body running them.

    Common questions

    Is this random number generator truly fair?

    Yes. It uses your device's secure random source, the same one used for passwords and encryption, and throws away the very rare draw that would make some numbers more likely. Every allowed number has exactly the same chance, and nothing is sent to a server.

    How do I generate random numbers with no repeats?

    Switch repeats off. Each pick is then made from the numbers not yet drawn, like drawing balls from a bag without putting them back, so the second pick from 1 to 100 is a fair choice from the 99 that are left.

    What are the odds of winning a 6 from 49 lottery?

    The odds of one line matching all six balls are 1 in 13,983,816, from 49 × 48 × 47 × 46 × 45 × 44 ÷ (6 × 5 × 4 × 3 × 2 × 1). Every line, including 1, 2, 3, 4, 5, 6, has exactly the same chance.

    Are some lottery numbers luckier than others?

    No. Every combination is equally likely, so lucky or due numbers don't exist. Picking numbers others avoid, such as those above 31, doesn't change your odds of winning, but can mean sharing a prize with fewer people. This tool isn't connected to any lottery.

    Can I leave some numbers out of the draw?

    Yes. Numbers you leave out, or the odd or even ones if you choose even or odd only, are taken out of the list of choices before the draw. The numbers that remain all keep exactly equal chances of being picked.

    How does the team splitter work?

    Names are shuffled with the Fisher–Yates shuffle, where the last place is filled by a fair pick from everyone, the next from everyone left, and so on. Teams are then dealt out in turn, so team sizes differ by at most one.

    Related calculators

    Standard deviation calculatorStandard deviation, variance, mean, median, mode, quartiles, outliers and confidence intervals from a list or a frequency table.Average calculatorMean, median, mode and range of a list, weighted averages, averages of percentages and times, moving averages and the number you need next.Scientific calculatorTrig, logs, powers, roots, factorials, nCr and nPr, memory and history, with degrees, radians or gradians and answers as fractions.Percentage calculatorX% of Y, % change, reverse %, VAT and % points.

    Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.

    Embed this calculator on your site

    Free to use on your website or blog. Paste this code where you want the calculator to appear. Please keep the credit link.

    Random number generator by Zulu Calculator ↗