HomeAll CategoriesRandom Number Generator 1-100 (Free) | StatsUnlock

Random Number Generator 1-100 (Free) | StatsUnlock

Random Number Generator

A free random number generator for any range: 1 to 100, 1 to 10, 1 to 6 or your own. Pick numbers with or without repeats, spin a number wheel, make 4 or 6 digit PINs, draw giveaway winners or lottery lines, all with secure, fair randomness.

No RepeatsWheel SpinnerGiveawaysPINsLotterySecure & Fair

🎲 1. Random Number Generator

Generator

INTEGERS
Press Generate
Advanced options: secure or seeded

Secure mode (default) uses the Web Crypto API and cannot be predicted. Seeded mode uses the sfc32 generator: the same seed and settings always give the same numbers. Never use a seed for prizes.

Your Result

___
Press Generate
Range
___
Randomness source
___

History

    How this result was made
    Every allowed value has exactly the same chance
    ___

    📊 2. Your Results

    Press Generate above. Your full list, the chance of each value, the average, repeats, a frequency chart and a fairness check will appear here.

    ⚡ Quick Answer

    A random number generator picks numbers from a range so that every value has exactly the same chance and nothing can be predicted.

    P(each number) = 1 ÷ (Max − Min + 1)  ·  1 to 100: 1 in 100 (1%)

    Rule of thumb: use secure mode and No repeats for raffles and giveaways, and a seed only when you need the same numbers again.

    Key Takeaways

    • A random number generator gives every number in the range the same chance: 1 in 100 for 1 to 100, 1 in 6 for 1 to 6.
    • Drawing 10 numbers from 1 to 100 with repeats allowed gives at least one repeat about 37% of the time.
    • No repeats means drawing without replacement, so 1 to 10 can give at most 10 different numbers.
    • A 4-digit PIN has 10,000 possibilities with leading zeros and 9,000 without.
    • Powerball odds stay 1 in 292,201,338 whether you choose the numbers or a generator does.

    📚 3. What Is a Random Number Generator?

    A random number generator (RNG) is a device or algorithm that produces numbers with no pattern, where every allowed value is equally likely. Dice, coins and lottery ball machines are physical generators. Software generators, like this one, use mathematics to turn unpredictable input into numbers in your chosen range.

    A worked one-liner: for a random number from 1 to 6 there are 6 possible values, so each has a chance of 1 ÷ 6 = 16.67%, exactly like a fair die.

    3.1 Pseudo random vs true random number generators

    TypeHow it worksRepeatable?Predictable?Good for
    Pseudo random (PRNG)A formula updates a hidden state from a seedYes, with the same seedYes, if the seed or state is knownSimulations, games, teaching, repeatable research
    Cryptographically secure (CSPRNG)A hardened formula fed with system entropyNoNo, in practiceGiveaways, raffles, security tokens (this tool’s default)
    True random (TRNG)Measures physical noise: electronic, atmospheric or quantumNoNoHardware security modules, scientific draws
    Physical (dice, balls)Mechanical chanceNoNo, if fairBoard games, official lottery draws

    The tool works as a random whole number generator, a decimal generator and a list picker. This online random number generator uses the browser’s Web Crypto API by default, a cryptographically secure generator seeded from your device. Seeded mode switches to the sfc32 pseudo random generator so you can see how a seed makes results repeat. Most spreadsheets and programming languages use the Mersenne Twister PRNG by default (Matsumoto & Nishimura, 1998).

    3.2 What makes a random number generator fair?

    Two things. First, unpredictability: nobody should be able to guess the next number. Second, no bias: the simple trick of taking a big random value and using the remainder after division favours small numbers slightly whenever the range does not divide evenly. This generator removes that bias with rejection sampling (Lemire, 2019), so 1 to 600 or 1 to 7 is exactly as fair as 1 to 8.

    🧠 4. Interpretation of Your Result

    Generate a number above. Sections 4.1 to 4.5 will explain your own result: ___ and the chance of ___.

    4.6 Common mistakes this generator prevents

    • Hidden bias from the remainder trick. Rejection sampling keeps every value equally likely.
    • Accidental repeats in a raffle. No repeats draws without replacement and refuses impossible requests.
    • Lost proof of a draw. Download TXT or CSV, or copy the fair-draw record in Section 5.
    • Predictable picks. Secure mode cannot be repeated; seeded mode is clearly labelled.

    4.7 The gambler’s fallacy

    If 7 has not come up in a while, it is not “due”. Every press is independent, so each value keeps exactly the same chance. People expect short random runs to look evenly spread, which is why real randomness often feels streaky (Tversky & Kahneman, 1971).

    ✍ 5. How to Use Your Result

    Five ready-to-copy cards, filled in with your own result.

    Generate a number to fill in a share line, a giveaway announcement, a fair-draw record, a research note and a spreadsheet line. Values: ___

    ∑ 6. Formulas Used

    ①
    Chance of each number (discrete uniform)
    P(X = k) = 1 ÷ (b − a + 1)
    a, bMin and Max, whole numbers
    kAny value from a to b
    Example1 to 100: 1 ÷ 100 = 1%; 1 to 6: 16.67%
    ②
    Turning random bits into your range, without bias
    n = b − a + 1  ·  keep u only if u < ⌊232 ÷ n⌋ × n  ·  x = a + (u mod n)
    uA raw 32-bit random integer, 0 to 4,294,967,295
    modThe remainder after division
    RuleValues of u above the cut-off are redrawn, which removes modulo bias
    Examplen = 6: cut-off 4,294,967,292; only 4 of 4.3 billion values are ever redrawn
    ③
    Counting results with no repeats
    Ordered: P(n, k) = n! ÷ (n − k)!  ·  Unordered sets: C(n, k) = n! ÷ (k! (n − k)!)
    nHow many values are in the range
    kHow many you draw, at most n
    Example10 from 1 to 100: C(100, 10) = 17,310,309,456,440 possible sets
    ④
    Chance of at least one repeat (birthday problem)
    P(repeat) = 1 − n! ÷ ((n − k)! × nk)
    n, kRange size and number of draws, repeats allowed
    Example10 draws from 1 to 100: 37.18%; 23 from 365: 50.73%
    Use forKnowing when repeats are normal, and when to tick No repeats
    ⑤
    Expected average and spread
    μ = (a + b) ÷ 2  ·  σ = √(((b − a + 1)2 − 1) ÷ 12)
    μLong-run average of a fair draw
    σStandard deviation of one draw
    Example1 to 100: μ = 50.5, σ = 28.87
    ⑥
    Fairness check: chi-square goodness of fit
    χ2 = Σ (O − E)2 ÷ E,   df = bins − 1
    OHow many times each value (or bin) appeared
    EExpected count = total ÷ bins
    Rulep ≥ 0.05: consistent with a fair draw (Pearson, 1900)
    RequiresAt least 5 expected per bin
    ⑦
    Lottery odds
    Odds = C(N, k) × C(M, j)
    N, kMain pool and main picks: Powerball 69 and 5
    M, jBonus pool and picks: Powerball 26 and 1
    ExamplePowerball: 11,238,513 × 26 = 292,201,338; Mega Millions: 12,103,014 × 24 = 290,472,336

    📝 7. How Do You Use a Random Number Generator?

    To use a random number generator, choose the type of result, set Min and Max (for example 1 and 100), choose how many numbers you need and whether repeats are allowed, then press Generate. Each number in the range has the same chance, and the result appears instantly.

    Worked example all the way through: 10 different numbers from 1 to 100 for a raffle.

    1. Choose a tab. Pick Integers for whole numbers, Decimals, Digits / PIN, List picker, Lottery, Wheel or Phone. Our example uses Integers.
    2. Set the range. Type Min and Max, for example 1 and 100, or tap a quick chip such as 1–10 or 1–100.
    3. Choose how many. Type how many numbers you need, from 1 to 10,000. For the example, type 10.
    4. Decide on repeats. Tick No repeats if every number must be different, as in a raffle. Leave it off for dice-style draws.
    5. Pick a sort order. Open Advanced options to sort the results from low to high or high to low, or keep them in draw order.
    6. Choose secure or seeded. Keep Secure for draws and prizes. Turn on Seeded and type a seed only when you need the same numbers again.
    7. Press Generate. Press Generate or the Enter key. The numbers appear on the display and in the result panel at once.
    8. Check the odds. The result panel shows the chance of each value, for example 1 in 100 (1%) for 1 to 100.
    9. Read Section 2. Scroll to Your Results for the full list, the average, repeats, a frequency chart and a chi-square fairness check.
    10. Copy, save or share. Press Copy on the display to copy every result, tap a single number to copy just that one, or use Download TXT and CSV. Choose comma, new line or space in Advanced options.

    7.1 How do you pick a random number from 1 to 100, 1 to 10 or 1 to 6?

    • Random number generator 1 to 100: tap 1–100 and press Generate. Each number has a 1% chance.
    • Random number generator 1 to 10: tap 1–10 for a number 1 through 10. Each number has a 10% chance.
    • Random number generator 1 to 6: tap 1–6 for a virtual die roll (a random number generator between 1 and 6), or set How many to roll several dice.
    • Random number generator 1 to 2 or 1 to 3: tap 1–2 for a coin toss, 1–3 to choose 1 through 3.
    • Random number generator 1 to 100,000: tap 1–100,000 (or 1–10,000). Each number has a 1 in 100,000 (0.001%) chance.
    • Any other range, such as 1 to 600, type Min and Max yourself.

    7.2 How do you use the random number generator wheel and spinner?

    The random number wheel generator works like a classroom spinner. Open the Wheel tab, set Min and Max (up to 60 numbers) and press Spin the wheel. The secure generator chooses the number first, then the wheel spins and stops on it, so it is as fair as the plain generator, just more fun on a classroom screen.

    7.3 How do you pick giveaway winners?

    Use the List picker as a random number generator for giveaways. Open List picker, paste entries one per line (or separated by commas), set Winners and press Pick winners. Each entry has the same chance and nobody can win twice unless you allow it.

    7.4 Random number generator, no repeats, lists and sequences

    For a random number generator no repeats draw, tick No repeats before you press Generate. To use it as a random number list generator or random number sequence generator, raise How many (up to 10,000) and choose a sort order. Asking for every number in the range with no repeats gives a random order of the whole range.

    7.5 PINs, lottery lines and phone numbers

    The Digits / PIN tab is a 4 digit random number generator for PINs and locker codes, and a 6 digit random number generator for verification-style codes. The Lottery tab works as a Powerball random number generator or Mega Millions random number generator, and the Phone tab is a random phone number generator that only uses fictional, reserved numbers.

    It runs in any browser, so it works like a random number generator app on your phone with nothing to install, and it is a free online random number generator on a laptop or classroom screen.

    📈 8. How to Make a Random Number Generator in Excel

    An Excel random number generator needs only one function.

    The one-cell answer: =RANDBETWEEN(1,100) gives a random whole number from 1 to 100. Press F9 for a new one.

    8.1 Excel random functions

    TaskExcel formulaNotes
    Whole number in a range=RANDBETWEEN(1,100)Both ends included
    Decimal from 0 to 1=RAND()Never exactly 1
    Decimal in a range, 2 dp=ROUND(RAND()*(10-5)+5,2)Min 5, Max 10
    List of 10 (Excel 365)=RANDARRAY(10,1,1,100,TRUE)Repeats possible
    10 with no repeats (365)=TAKE(SORTBY(SEQUENCE(100),RANDARRAY(100)),10)Shuffle, then take
    4-digit PIN=TEXT(RANDBETWEEN(0,9999),"0000")Keeps leading zeros
    Pick a name=INDEX(A2:A9,RANDBETWEEN(1,ROWS(A2:A9)))One winner

    8.2 Step by step

    1 One random number

    =RANDBETWEEN(1,100)

    Type it in any cell. Change 1 and 100 for other ranges, such as 1 to 6 for a die.

    Xrandom.xlsx - ExcelA2fx=RANDBETWEEN(1,100)AB1Random 1-100Formula247RANDBETWEEN(1,100)30.6182RAND()43RANDBETWEEN(1,6)

    A whole number, a decimal from RAND() and a die roll. Your values will differ every time.

    2 A list of random numbers

    =RANDARRAY(10,1,1,100,TRUE)

    In Excel 365 this spills 10 whole numbers down the column. In older Excel, fill =RANDBETWEEN(1,100) down 10 rows.

    Xrandom.xlsx - ExcelA2fx=RANDARRAY(10,1,1,100,TRUE)A110 numbers, 1-1002823144635146977...

    Notice 14 appears twice: repeats are normal, about 37% of the time for 10 draws from 100.

    3 No repeats

    =TAKE(SORTBY(SEQUENCE(100),RANDARRAY(100)),10)

    This shuffles 1 to 100 and keeps the first 10, the same method as this tool’s no-repeat draw. In older Excel, put 1 to 100 in column A, =RAND() in column B, sort by B and take the top 10.

    Xrandom.xlsx - ExcelA2fx=TAKE(SORTBY(SEQUENCE(100),RANDARRAY(100)),10)A1No repeats236384715556927...

    Ten different numbers, every possible set of 10 equally likely.

    4 4-digit and 6-digit codes

    =TEXT(RANDBETWEEN(0,9999),"0000")

    The TEXT function keeps leading zeros. For 6 digits use =TEXT(RANDBETWEEN(0,999999),"000000").

    Xrandom.xlsx - ExcelA2fx=TEXT(RANDBETWEEN(0,9999),"0000")AB14-digit PINNote20472leading zero kept3903140058stored as text

    0472 and 0058 keep their zeros because they are stored as text.

    5 Pick a random winner

    =INDEX(A2:A9,RANDBETWEEN(1,ROWS(A2:A9)))

    Put names in column A. The formula returns one at random.

    Xrandom.xlsx - ExcelB2fx=INDEX(A2:A9,RANDBETWEEN(1,ROWS(A2:A9)))AB1EntriesWinner2AshaDivya3Ben4Chen5Divya6Ethan

    For several winners with no repeats, use the shuffle method in step 3 on the names.

    8.3 The awkward cases

    • Numbers keep changing. RAND and RANDBETWEEN recalculate on every edit. Copy the cells, then Paste Special > Values to freeze them.
    • No seed. Excel worksheet functions cannot be seeded, so a draw cannot be repeated exactly. Use R, Python or this tool’s seeded mode for that.
    • Not for passwords. Excel’s generator is not designed for security.

    8.4 Why answers differ between Excel, R, Python and this tool

    Random numbers are meant to differ. What must agree are the probabilities: every tool gives 1 to 100 a 1% chance per number, an expected average of 50.5 and a 37.18% chance of a repeat in 10 draws. Seeds do not carry across software: seed 42 in R, Python and this tool each use a different algorithm, so they give different sequences.

    8.5 Charting a fairness check in Excel

    Generate 1,000 numbers from 1 to 10 in A2:A1001, list 1 to 10 in C2:C11, use =COUNTIF($A$2:$A$1001,C2) in D2 and fill down, then insert a column chart. Each bar should be near 100.

    8.6 Error messages

    ErrorCauseFix
    #NUM!RANDBETWEEN bottom larger than topSwap the numbers
    #NAME?RANDARRAY or TAKE in older ExcelUse RANDBETWEEN and the sort method
    #SPILL!Cells below a spilling formula are not emptyClear the cells underneath
    #VALUE!Text in a range argumentUse plain numbers

    Google Sheets supports RAND, RANDBETWEEN and RANDARRAY the same way; TAKE is newer, so use =ARRAY_CONSTRAIN(SORT(SEQUENCE(100),RANDARRAY(100),TRUE),10,1) in Sheets.

    📈 9. How to Generate Random Numbers in R

    An R random number generator is one line: sample(1:100, 1). R’s sample() covers every kind of random draw. The script below makes single numbers, lists with and without repeats, PINs and winners, prints the exact probabilities and saves one 300 dpi fairness chart.

    9.1 The complete script

    R, base only, saves rng_fairness.png

    # ============================================================
    # Random number generator examples in R, StatsUnlock
    # https://statsunlock.com/random-number-generator/
    # Base R only. No packages to install.
    # ============================================================
    
    set.seed(42)              # remove this line for different numbers each run
    
    # ---- 1. One number from 1 to 100 ---------------------------
    sample(1:100, 1)
    
    # ---- 2. Ten numbers, repeats allowed and not allowed -------
    with_repeats <- sample(1:100, 10, replace = TRUE)
    no_repeats   <- sample(1:100, 10)                # replace = FALSE is the default
    print(with_repeats); print(no_repeats)
    
    # ---- 3. Decimals, dice, PINs and a winner ------------------
    round(runif(5, min = 0, max = 1), 2)             # 0 to 1, 2 decimal places
    sample(1:6, 3, replace = TRUE)                    # three dice
    sprintf("%04d", sample(0:9999, 1))                # 4-digit PIN with leading zeros
    entries <- c("Asha", "Ben", "Chen", "Divya", "Ethan")
    sample(entries, 2)                                # two winners, no repeats
    
    # ---- 4. The exact probabilities (same in every tool) -------
    n <- 100; k <- 10
    cat("Chance of each number:", 1 / n, "\n")                       # 0.01
    cat("Expected average:", (1 + n) / 2, "\n")                      # 50.5
    cat("Chance of a repeat in 10 draws:", 1 - prod((n - 0:(k - 1)) / n), "\n")  # 0.3718
    cat("Possible sets of 10 with no repeats:", choose(n, k), "\n")  # 1.731031e+13
    
    # ---- 5. Fairness check and one figure ----------------------
    x <- sample(1:10, 1000, replace = TRUE)
    counts <- table(factor(x, levels = 1:10))
    test <- chisq.test(counts)
    png("rng_fairness.png", width = 7, height = 4.5, units = "in", res = 300)
    barplot(counts, col = "#86efac", border = "#15803d",
            main = "1,000 random numbers from 1 to 10", ylab = "Count")
    abline(h = 100, lty = 2, col = "#7c3aed")
    dev.off()
    cat(sprintf("Verdict: chi-square = %.2f, p = %.3f. %s\n", test$statistic, test$p.value,
        ifelse(test$p.value >= 0.05, "Consistent with a fair generator.", "Unusual spread, try a bigger sample.")))

    9.2 What each line does

    Line or functionWhat it does
    set.seed(42)Fixes the starting point so the same numbers come out every run. R uses the Mersenne Twister by default.
    sample(1:100, 1)One whole number from 1 to 100, each with a 1% chance.
    replace = TRUEAllows repeats (with replacement). The default, FALSE, gives no repeats.
    runif(5, 0, 1)Five decimals spread evenly from 0 to 1.
    sprintf("%04d", ...)Pads a number with leading zeros, 47 becomes 0047.
    choose(n, k)Number of possible sets with no repeats, C(n, k).
    chisq.test(counts)Chi-square goodness-of-fit test against equal counts.

    9.3 What the figure shows

    Ten bars, each close to the dashed line at 100. Small differences are normal; the chi-square p-value tells you whether they are bigger than chance would explain.

    9.4 Problems and fixes

    • Different numbers from a colleague with the same seed. R 3.6.0 changed sample() to a bias-free method. Older R gives different results; run RNGversion("3.5.0") only to reproduce old work.
    • Error: cannot take a sample larger than the population. You asked for more no-repeat numbers than the range holds.
    • sample(5, 1) gives 1 to 5. A single number n means 1:n; write sample(c(5), 1) if you really mean the number 5.

    9.5 One-liners

    sample(1:6, 1) die  ·  sample(0:1, 1) coin  ·  sample(1:1000, 5) five from 1–1000  ·  sort(sample(1:69, 5)) Powerball whites

    📈 10. How to Make a Random Number Generator in Python

    A Python random number generator takes two lines: import random and random.randint(1, 100). Python has two random modules: random for simulations and games, and secrets for anything that must not be guessed, such as codes and prize draws.

    randomMersenne Twister, seedable
    secretssecure, for codes and draws
    scipychi-square test
    matplotlibthe chart

    Install with pip install scipy matplotlib. random and secrets come with Python 3.8 or newer.

    10.1 The complete script

    Python 3.8+, saves rng_fairness.png

    # ============================================================
    # Random number generator examples in Python, StatsUnlock
    # https://statsunlock.com/random-number-generator/
    # ============================================================
    import math
    import random
    import secrets
    from collections import Counter
    import matplotlib.pyplot as plt
    from scipy.stats import chisquare
    
    random.seed(42)          # remove for different numbers each run (never for prizes)
    
    # ---- 1. One number from 1 to 100 ---------------------------
    print(random.randint(1, 100))
    
    # ---- 2. Ten numbers, repeats allowed and not allowed -------
    print([random.randint(1, 100) for _ in range(10)])   # repeats possible
    print(random.sample(range(1, 101), 10))              # no repeats
    
    # ---- 3. Decimals, dice, PINs and a secure winner -----------
    print(round(random.random(), 2))                     # 0 to 1, 2 decimal places
    print([random.randint(1, 6) for _ in range(3)])      # three dice
    print(f"{secrets.randbelow(10000):04d}")             # 4-digit PIN, secure
    entries = ["Asha", "Ben", "Chen", "Divya", "Ethan"]
    print(secrets.SystemRandom().sample(entries, 2))     # two winners, secure
    
    # ---- 4. The exact probabilities (same in every tool) -------
    n, k = 100, 10
    p_repeat = 1 - math.prod((n - i) / n for i in range(k))
    print("Chance of each number:", 1 / n)                # 0.01
    print("Expected average:", (1 + n) / 2)               # 50.5
    print(f"Chance of a repeat in 10 draws: {p_repeat:.4f}")   # 0.3718
    print("Possible sets of 10 with no repeats:", math.comb(n, k))   # 17310309456440
    
    # ---- 5. Fairness check and one figure ----------------------
    x = [random.randint(1, 10) for _ in range(1000)]
    counts = [Counter(x)[v] for v in range(1, 11)]
    stat, p = chisquare(counts)
    fig, ax = plt.subplots(figsize=(7, 4.5))
    ax.bar(range(1, 11), counts, color="#86efac", edgecolor="#15803d")
    ax.axhline(100, ls="--", color="#7c3aed")
    ax.set(title="1,000 random numbers from 1 to 10", xlabel="Value", ylabel="Count")
    fig.tight_layout(); fig.savefig("rng_fairness.png", dpi=300)
    print(f"Verdict: chi-square = {stat:.2f}, p = {p:.3f}. "
          + ("Consistent with a fair generator." if p >= 0.05 else "Unusual spread, try a bigger sample."))

    10.2 What each line does

    Line or functionWhat it does
    random.seed(42)Makes the random module repeat the same sequence.
    random.randint(1, 100)One whole number, both ends included.
    random.sample(range(1, 101), 10)Ten different numbers, no repeats.
    secrets.randbelow(10000)A secure number from 0 to 9,999, formatted as a 4-digit PIN.
    secrets.SystemRandom().sampleSecure no-repeat draw for giveaways.
    math.comb(n, k)Number of possible sets, C(n, k).
    chisquare(counts)Tests whether the counts are consistent with equal chances.

    10.3 What the figure shows

    The same ten-bar chart as the R version, with a dashed line at the fair expectation of 100 per value.

    10.4 Problems and fixes

    • randint(1, 100) can return 100; range(1, 100) stops at 99. Use range(1, 101) for 1 to 100.
    • ValueError: Sample larger than population. Too many no-repeat numbers for the range.
    • Using random for passwords. Switch to secrets; random can be predicted from its output.
    • numpy differs. numpy’s default_rng().integers(1, 101) excludes the top value, so write 101 for 1 to 100.

    10.5 One-liners

    random.choice(range(1, 7)) die  ·  random.uniform(0, 1) decimal  ·  random.shuffle(lst) random order  ·  secrets.token_hex(4) secure hex code

    📋 11. Reference Tables

    11.1 Random number generator ranges: chance of each number

    RangeTypical useChance of each numberExpected average
    Random number generator 1-2Coin toss, yes or no1 in 2 (50%)1.5
    Random number generator 1-3Pick one of three options1 in 3 (33.33%)2
    Random number generator 1-4Four teams or choices1 in 4 (25%)2.5
    Random number generator 1-5Five options, rating scales1 in 5 (20%)3
    Random number generator 1-6Virtual die roll1 in 6 (16.67%)3.5
    Random number generator 1-7Day of the week1 in 7 (14.29%)4
    Random number generator 1-8Eight-sided die, team draws1 in 8 (12.5%)4.5
    Random number generator 1-10Classroom picks, quick games1 in 10 (10%)5.5
    Random number generator 1-12Months, twelve-sided die1 in 12 (8.333%)6.5
    Random number generator 1-15Small groups1 in 15 (6.667%)8
    Random number generator 1-20Twenty-sided die (d20)1 in 20 (5%)10.5
    Random number generator 1-30Class list, days of a month1 in 30 (3.333%)15.5
    Random number generator 1-50Raffles, bingo-style games1 in 50 (2%)25.5
    Random number generator 1-100Percentages, raffles, games1 in 100 (1%)50.5
    Random number generator 1-600Large raffles1 in 600 (0.1667%)300.5
    Random number generator 1-1,000Big giveaways1 in 1,000 (0.1%)500.5
    Random number generator 1-10,000Ticket numbers, sample IDs1 in 10,000 (0.01%)5000.5
    Random number generator 1-100,000Large lotteries, record sampling1 in 100,000 (0.001%)50000.5
    Random number generator 0-1Decimals, probabilitiesany value, 2 dp by default0.5

    What to conclude: the chance is always 1 divided by the number of values. Every row is equally fair.

    11.2 How likely is a repeat? (repeats allowed)

    Range sizeNumbers drawnChance of at least one repeat
    6216.67%
    6344.44%
    10328.00%
    10569.76%
    1001037.18%
    1002086.96%
    3652350.73%
    1,0004054.64%

    What to conclude: repeats come much sooner than people expect. Use No repeats for raffles.

    11.3 How many codes are possible?

    CodeWith leading zerosWithout leading zerosChance of guessing in one try
    3-digit1,0009001 in 1,000
    4-digit PIN10,0009,0001 in 10,000
    5-digit100,00090,0001 in 100,000
    6-digit1,000,000900,0001 in 1,000,000
    8-digit100,000,00090,000,0001 in 100,000,000

    What to conclude: each extra digit makes guessing 10 times harder.

    11.4 Lottery odds

    GameMain numbersBonusJackpot odds
    Powerball5 of 1–691 of 1–261 in 292,201,338
    Mega Millions5 of 1–701 of 1–241 in 290,472,336
    Pick 6 of 49 (no bonus)6 of 1–49none1 in 13,983,816

    What to conclude: a generated line has the same odds as any chosen line. Game rules as published by Powerball and US state lotteries, checked November 2026; confirm with your official lottery before playing.

    11.5 Random functions in common software

    SoftwareOne number 1 to 100No repeatsDefault algorithm
    This toolMin 1, Max 100, GenerateTick No repeatsWeb Crypto (secure); sfc32 when seeded
    Excel=RANDBETWEEN(1,100)SORTBY + SEQUENCE + RANDARRAYNot seedable
    Google Sheets=RANDBETWEEN(1,100)SORT + RANDARRAYNot seedable
    Rsample(1:100, 1)sample(1:100, 10)Mersenne Twister
    Pythonrandom.randint(1, 100)random.sample(range(1, 101), 10)Mersenne Twister; secrets is secure

    What to conclude: every tool gives the same probabilities; only the algorithm and seed handling differ.

    11.6 Fictional phone number ranges

    CountryReserved rangeExample
    United States555-0100 to 555-0199 (any area code)(312) 555-0147
    United Kingdom, mobile07700 900000 to 07700 90099907700 900321

    What to conclude: only these ranges are safe for examples and testing. Sources: Ofcom numbers for drama; North American Numbering Plan fictitious range.

    📈 12. Example Results

    1
    TEXTBOOK CASE

    One number from 1 to 100

    The classic use.

    A quiz host needs one random number from 1 to 100.

    Range: 1 to 100Possible values: 100Chance of each: 1 in 100 (1%)
    ItemValue
    Range1 to 100
    Possible values100
    Chance of each1 in 100 (1%)
    Expected average50.5
    47
    One number from 1 to 100: Chance of each 1 in 100 (1%).

    What it means: Every number from 1 to 100 had the same 1% chance. A result of 1 or 100 is just as likely as 50.

    How to use it: Press Generate again for a fresh number; each press is independent.

    2
    SMALL RANGE

    Rolling a die (1 to 6)

    A virtual die.

    A board game is missing its die.

    Range: 1 to 6Chance of each: 1 in 6 (16.67%)Three dice at once: How many = 3
    ItemValue
    Range1 to 6
    Chance of each1 in 6 (16.67%)
    Three dice at onceHow many = 3
    Chance two of three match44.44%
    353
    Rolling a die (1 to 6): Three dice at once How many = 3.

    What it means: Each roll has a 16.67% chance per face. Rolling three dice and getting a pair happens 44% of the time.

    How to use it: Set How many to the number of dice; leave No repeats off.

    3
    CODES

    A 4-digit PIN

    Leading zeros matter.

    A teacher needs random 4-digit locker codes.

    Digits: 4Leading zeros: allowedPossible codes: 10,000
    ItemValue
    Digits4
    Leading zerosallowed
    Possible codes10,000
    Guess in one try1 in 10,000
    0472
    A 4-digit PIN: Possible codes 10,000.

    What it means: Codes like 0472 count, so there are 10,000 possibilities. Without leading zeros there are 9,000.

    How to use it: Use the Digits / PIN tab; download CSV to keep the list.

    4
    BORDERLINE

    All numbers with no repeats

    How many equals the range.

    10 students need a random speaking order.

    Range: 1 to 10How many: 10No repeats: on
    ItemValue
    Range1 to 10
    How many10
    No repeatson
    Possible orders3,628,800
    72915
    All numbers with no repeats: No repeats on.

    What it means: Asking for all 10 numbers with no repeats gives a random order (a shuffle). Every one of the 10! = 3,628,800 orders is equally likely.

    How to use it: Use it to shuffle a running order or a seating plan.

    5
    EXTREME INPUT

    A huge range

    Up to 9 quadrillion.

    A developer needs a random ID from 1 to 1,000,000,000,000.

    Range size: 1,000,000,000,000Chance of each: 1 in 1 trillionMethod: 53-bit rejection sampling
    ItemValue
    Range size1,000,000,000,000
    Chance of each1 in 1 trillion
    Method53-bit rejection sampling
    Biasnone
    8,204…
    A huge range: Method 53-bit rejection sampling.

    What it means: Even in a trillion-number range, every value has exactly the same chance because the generator draws 53 random bits and rejects the few values that would cause bias.

    How to use it: For database keys, also check for collisions in your system.

    6
    MISLEADING READING

    Is 7 “due”?

    The gambler’s fallacy.

    In 30 draws from 1 to 10, the number 7 never appeared.

    Draws without a 7: 30Chance of that: 4.24%Chance of 7 next: still 10%
    ItemValue
    Draws without a 730
    Chance of that4.24%
    Chance of 7 nextstill 10%
    Memory of past drawsnone
    7?
    Is 7 “due”?: Chance of 7 next still 10%.

    What it means: Thirty draws without a 7 is uncommon (about 4%) but not suspicious, and it does not make 7 more likely next time. The generator has no memory.

    How to use it: Judge fairness with the chi-square check on a large sample, not on streaks.

    7
    INVALID INPUT

    12 numbers from 1 to 10, no repeats

    An impossible request.

    Someone asks for 12 different numbers from 1 to 10.

    Range size: 10Requested: 12, no repeatsResult: error message
    ItemValue
    Range size10
    Requested12, no repeats
    Resulterror message
    Fixwiden the range or lower How many
    !
    12 numbers from 1 to 10, no repeats: Result error message.

    What it means: There are only 10 different numbers, so the tool explains the problem instead of silently repeating numbers.

    How to use it: Change Max to 12 or more, or ask for 10 or fewer.

    8
    APPLIED

    Giveaway with 250 entries

    Three winners, fair and recorded.

    An Instagram giveaway has 250 comments and 3 prizes.

    Entries: 250Winners: 3, no repeatsChance per entry: 1.2%
    ItemValue
    Entries250
    Winners3, no repeats
    Chance per entry1.2%
    ProofTXT download and fair-draw record
    ABC
    Giveaway with 250 entries: Chance per entry 1.2%.

    What it means: Each entry had a 3 in 250 (1.2%) chance and nobody could win twice. Secure mode means the draw cannot be repeated or predicted.

    How to use it: Paste entries into List picker, pick 3, then copy the announcement from Section 5.

    🧪 13. How to Get Your Numbers Right

    1. Count your options first. 25 entries means Min 1, Max 25.
    2. Number entries before the draw and publish the list, so winners can be checked.
    3. Decide on repeats before drawing, not after.
    4. Use secure mode for prizes and seeded mode only for repeatable teaching or research.
    5. Record the time, settings and result with the fair-draw card or TXT download.
    6. Draw once. Redrawing until you like the result breaks fairness.
    7. For codes, decide on leading zeros before generating.
    8. For big lists, use CSV rather than copying from the screen.
    9. Test fairness with a big sample: 1,000 numbers from 1 to 10 should give about 100 each.
    InputAllowed valuesWatch out for
    Min, MaxWhole numbers, Min ≤ Max, up to 9 quadrillionSwapped Min and Max
    How many1 to 10,000More than the range with No repeats
    Decimal places0 to 10 (default 2)Ends of the range appear half as often after rounding
    Digits1 to 15Leading zeros setting
    List entriesOne per line or comma separatedDuplicate names get double chances

    Common mistakes

    • Leaving duplicate entries in a giveaway list, which doubles that person’s chance.
    • Using a seed for a prize draw, which lets anyone with the seed repeat it.
    • Expecting no repeats when repeats are allowed.

    🎯 14. When Should You Use a Random Number Generator?

    Use a random number generator whenever a choice must be fair and free of bias: picking winners, assigning groups, sampling records, shuffling an order, making test data or rolling virtual dice. Use a seeded generator when the same random numbers must be produced again, and a password manager for passwords.

    Use it when

    • Running a raffle or giveaway
    • Picking students or teams fairly
    • Choosing a random sample for a survey or audit
    • Rolling dice or tossing a coin for a game
    • Making test data or example phone numbers

    Do not use it when

    • You need a password or encryption key: use a password manager
    • The law requires a certified draw, as in official lotteries
    • You need a weighted draw: not every entry with the same chance
    • You need random dates: use a date tool
    You need to...Use
    Pick numbers, codes or winners fairlyThis random number generator
    Plan the size of a random sampleMargin of Error Calculator
    Summarise a random sampleConfidence Interval Calculator
    See the spread of your numbersBox Plot Maker

    🔧 15. Troubleshooting and Common Errors

    I got the same number twice

    Cause: Repeats are allowed by default.

    Fix: Tick No repeats. With 10 draws from 1 to 100, a repeat happens 37% of the time, so it is normal.

    Error: more numbers than the range holds

    Cause: No repeats is on and How many is bigger than the range.

    Fix: Widen the range or lower How many.

    The same numbers keep coming back

    Cause: Seeded mode is on.

    Fix: Untick Seeded mode in Advanced options.

    Results look uneven

    Cause: Small samples are always uneven.

    Fix: Generate at least 5 per value and read the chi-square check.

    Another website gives different numbers

    Cause: Random numbers are meant to differ.

    Fix: Compare the probabilities, not the numbers. Seeds do not carry between tools.

    Decimal ends appear less often

    Cause: Rounding: only half an interval rounds to each end.

    Fix: Add one more decimal place, or widen the range slightly.

    The wheel will not spin

    Cause: Range larger than 60 numbers or Max not above Min.

    Fix: Use 2 to 60 numbers, or the Integers tab.

    My 4-digit code has 3 digits in Excel

    Cause: Excel drops leading zeros.

    Fix: Use TEXT(...,"0000") or import the CSV as text.

    ⚖ 16. Assumptions and Limitations

    Assumptions

    1. Your browser’s Web Crypto generator is working correctly. All current browsers provide it; if it is missing, the tool falls back to Math.random, which is fair but not secure.
    2. Every entry should have the same chance. Weighted draws are not supported.
    3. Decimal results are rounded to the places you choose, which gives the two end values half the chance of the others.
    4. Seeded results are repeatable only in this tool. Other software uses different algorithms.

    Limitations

    • Not a certified lottery or gaming RNG.
    • Not for passwords or encryption keys: use a password manager.
    • Up to 10,000 numbers per press; download CSV for long lists.
    • Phone numbers are fictional only, by design.

    🏁 17. Conclusion

    This random number generator will summarise your own result here: ___. Generate a number above.

    Whatever you draw, the same rules apply: every value equally likely, secure mode for anything that matters, no repeats when each pick must be different, and a record of the draw when others need to trust it. That is what makes a random number generator fair.

    ❓ 18. Frequently Asked Questions

    Q1. What is a random number generator?

    A random number generator (RNG) is a tool or algorithm that produces numbers with no predictable pattern, where every allowed value has the same chance. This online random number generator picks whole numbers, decimals, PINs, lottery lines or winners from a list, using your browser’s secure randomness.

    Q2. How does a random number generator work?

    Software generators start from a secret internal state, scramble it with a mathematical formula, and turn the output into a number in your range. This tool uses the Web Crypto API, which is seeded by your device’s operating system, then uses rejection sampling so every number from Min to Max is exactly equally likely.

    Q3. How do I generate a random number between 1 and 100?

    Set Min to 1 and Max to 100, or tap the 1–100 chip, then press Generate. Each number from 1 to 100 has a 1 in 100 (1%) chance. To get several numbers, change How many; tick No repeats if every number must be different.

    Q4. How do I pick a random number from 1 to 10?

    Tap the 1–10 chip or type Min 1 and Max 10, then press Generate. Every number has a 1 in 10 chance. The same works for 1 to 3, 1 to 4, 1 to 5, 1 to 6, 1 to 8, 1 to 12, 1 to 20, 1 to 30, 1 to 50 and 1 to 1000.

    Q5. How do I generate random numbers with no repeats?

    Tick No repeats and set How many. The generator then draws numbers without replacement, like pulling balls from a bag, so no number appears twice. How many cannot be larger than the size of the range: 1 to 10 can give at most 10 different numbers.

    Q6. What is a pseudo random number generator (PRNG)?

    A pseudo random number generator is an algorithm that produces a long sequence of numbers that look random but are fully determined by a starting value called the seed. The same seed always gives the same sequence. Turn on Seeded mode here to see this: the same seed repeats the same numbers.

    Q7. What is a true random number generator?

    A true random number generator (TRNG) measures an unpredictable physical process, such as electrical noise or quantum effects, instead of running a formula. Browsers do not expose a pure TRNG; the Web Crypto generator used here is a cryptographically secure generator seeded from hardware and system entropy, which is unpredictable in practice.

    Q8. Is this random number generator truly random and fair?

    It is unpredictable and unbiased for everyday use. Secure mode uses the Web Crypto API, the same randomness browsers use for encryption keys, and integers are drawn with rejection sampling so no value is favoured. The chi-square check in Section 2 lets you test a large sample yourself.

    Q9. Can I use this as a random number generator for giveaways?

    Yes. Use the List picker tab, paste one name or entry per line, set the number of winners and press Pick winners. Winners are drawn without repeats using secure randomness. Copy the fair-draw record in Section 5 or download the TXT file to keep proof of the draw.

    Q10. How does the random number generator wheel work?

    Open the Wheel tab, set a range of up to 60 numbers and press Spin the wheel. The winning number is chosen by the secure generator first, then the wheel spins and stops on it, so the animation never affects the result. It works as a random number spinner for classrooms and games.

    Q11. How do I make a random 4 digit number?

    Open the Digits / PIN tab, set Digits to 4 and tick Leading zeros if numbers like 0472 are allowed. With leading zeros there are 10,000 possible 4-digit codes; without them there are 9,000 (1000 to 9999). Use 6 digits for 1,000,000 codes.

    Q12. Can I generate a random phone number?

    Yes, but only fictional ones. The Phone tab creates US numbers in the 555-0100 to 555-0199 range and UK mobiles in Ofcom’s drama range 07700 900000 to 900999. These are reserved for films, testing and examples, so they never ring a real person.

    Q13. Does a random number generator help win Powerball or Mega Millions?

    No. A random number generator picks a valid line, but every line has the same odds: 1 in 292,201,338 for Powerball and 1 in 290,472,336 for Mega Millions. Random picks do avoid popular patterns like birthdays, which can reduce the chance of sharing a jackpot.

    Q14. Can a random number generator be predicted or rigged?

    A secure generator like the one used here cannot be predicted from its output. A seeded generator can be repeated by anyone who knows the seed, which is useful for research but wrong for prizes. Online tools that use a simple formula with a weak seed can be predictable.

    Q15. What is a seed in a random number generator?

    A seed is the starting value of a pseudo random generator. The same seed and settings always produce the same numbers, which makes results repeatable for teaching, testing and research. Leave Seeded mode off for draws and prizes so nobody can repeat or predict them.

    Q16. What is a random number between 0 and 1?

    Use the Decimal tab with Min 0 and Max 1 and choose the decimal places, 2 by default. Values like 0.37 are spread evenly between 0 and 1. This is the uniform distribution that spreadsheets, R and Python use as the building block for every other random number.

    Q17. How do I copy the random numbers?

    Press Copy in the top corner of the display to copy every result at once, or tap any single number to copy just that one. In Advanced options you can choose commas, one number per line, or spaces, which is handy for pasting into Excel, Google Sheets or a message.

    Q18. How do I make a random number generator in Excel?

    Use =RANDBETWEEN(1,100) for a whole number or =RAND() for a decimal from 0 to 1. Excel 365 can make a list with =RANDARRAY(10,1,1,100,TRUE). Values change every time the sheet recalculates; copy and Paste Values to freeze them. Section 8 shows no-repeat formulas.

    Q19. How do I generate random numbers in R?

    Use sample(1:100, 1) for one number, sample(1:100, 10) for ten with no repeats and replace = TRUE to allow repeats. Call set.seed(42) first to make results repeatable. runif(5) gives decimals between 0 and 1.

    Q20. How do I make a random number generator in Python?

    Import random and use random.randint(1, 100) for one number or random.sample(range(1, 101), 10) for ten with no repeats. For anything security related, such as codes or prize draws, use the secrets module: secrets.randbelow(100) + 1.

    📑 19. Cite This Tool

    APA 7th edition
    StatsUnlock. (2026). Random number generator [Online tool]. https://statsunlock.com/random-number-generator/
    BibTeX
    @misc{statsunlock_rng_2026, title={Random Number Generator}, author={{StatsUnlock}}, year={2026}, note={Online tool}, url={https://statsunlock.com/random-number-generator/}}
    Methods wording
    Random values were generated with the StatsUnlock Random Number Generator (2026), which draws integers with rejection sampling from the browser Web Crypto API so that every value in the range is equally likely.

    🔗 20. Related Tools

    📖 21. Glossary of Terms

    TermPlain-English meaning
    BiasWhen some values come up more often than they should. Good generators have none.
    Chi-square testA test that compares how often each value appeared with how often it should appear if the draw were fair.
    CSPRNGCryptographically secure pseudo random number generator: unpredictable even to someone who has seen earlier output.
    Discrete uniform distributionA set of whole numbers where each one has exactly the same chance.
    EntropyUnpredictable input, such as hardware timing noise, used to seed a generator.
    Expected averageThe long-run average of a fair draw: (Min + Max) ÷ 2.
    Fisher-Yates shuffleA method that puts a list in random order with every order equally likely.
    Gambler’s fallacyThe false belief that a number is “due” because it has not come up for a while.
    IntegerA whole number with no decimal part, such as 7, 0 or −3.
    Leading zeroA zero at the start of a code, as in 0472. Allowed for PINs, not for ordinary numbers.
    Mersenne TwisterA popular pseudo random generator used by default in Excel, R and Python’s random module.
    No repeats (without replacement)Each value can be drawn only once, like balls taken out of a bag.
    PRNGPseudo random number generator: a formula that makes numbers that look random from a seed.
    RangeAll the values between Min and Max that can be drawn.
    Rejection samplingThrowing away raw random values that would cause bias and drawing again.
    SeedThe starting value of a pseudo random generator. Same seed, same numbers.
    TRNGTrue random number generator: measures a physical process such as electrical noise.
    With replacementA value can be drawn again after it has been drawn, like rolling a die.

    📚 22. References

    1. Bentley, J., & Floyd, B. (1987). Programming pearls: A sample of brilliance. Communications of the ACM, 30(9), 754–757. https://doi.org/10.1145/30401.315746
    2. Blum, L., Blum, M., & Shub, M. (1986). A simple unpredictable pseudo-random number generator. SIAM Journal on Computing, 15(2), 364–383. https://doi.org/10.1137/0215025
    3. Durstenfeld, R. (1964). Algorithm 235: Random permutation. Communications of the ACM, 7(7), 420. https://doi.org/10.1145/364520.364540
    4. Ferrenberg, A. M., Landau, D. P., & Wong, Y. J. (1992). Monte Carlo simulations: Hidden errors from “good” random number generators. Physical Review Letters, 69(23), 3382–3384. https://doi.org/10.1103/PhysRevLett.69.3382
    5. Herrero-Collantes, M., & Garcia-Escartin, J. C. (2017). Quantum random number generators. Reviews of Modern Physics, 89(1), 015004. https://doi.org/10.1103/RevModPhys.89.015004
    6. L’Ecuyer, P. (1999). Tables of linear congruential generators of different sizes and good lattice structure. Mathematics of Computation, 68(225), 249–260. https://doi.org/10.1090/S0025-5718-99-00996-5
    7. L’Ecuyer, P., & Simard, R. (2007). TestU01: A C library for empirical testing of random number generators. ACM Transactions on Mathematical Software, 33(4), Article 22. https://doi.org/10.1145/1268776.1268777
    8. Lemire, D. (2019). Fast random integer generation in an interval. ACM Transactions on Modeling and Computer Simulation, 29(1), Article 3. https://doi.org/10.1145/3230636
    9. Marsaglia, G. (1968). Random numbers fall mainly in the planes. Proceedings of the National Academy of Sciences, 61(1), 25–28. https://doi.org/10.1073/pnas.61.1.25
    10. Marsaglia, G. (2003). Xorshift RNGs. Journal of Statistical Software, 8(14), 1–6. https://doi.org/10.18637/jss.v008.i14
    11. Marsaglia, G., & Tsang, W. W. (2002). Some difficult-to-pass tests of randomness. Journal of Statistical Software, 7(3), 1–9. https://doi.org/10.18637/jss.v007.i03
    12. Matsumoto, M., & Nishimura, T. (1998). Mersenne twister: A 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Transactions on Modeling and Computer Simulation, 8(1), 3–30. https://doi.org/10.1145/272991.272995
    13. Metropolis, N., & Ulam, S. (1949). The Monte Carlo method. Journal of the American Statistical Association, 44(247), 335–341. https://doi.org/10.1080/01621459.1949.10483310
    14. Park, S. K., & Miller, K. W. (1988). Random number generators: Good ones are hard to find. Communications of the ACM, 31(10), 1192–1201. https://doi.org/10.1145/63039.63042
    15. Pearson, K. (1900). On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling. Philosophical Magazine, 50(302), 157–175. https://doi.org/10.1080/14786440009463897
    16. Salmon, J. K., Moraes, M. A., Dror, R. O., & Shaw, D. E. (2011). Parallel random numbers: As easy as 1, 2, 3. Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, Article 16. https://doi.org/10.1145/2063384.2063405
    17. Sunar, B., Martin, W. J., & Stinson, D. R. (2007). A provably secure true random number generator with built-in tolerance to active attacks. IEEE Transactions on Computers, 56(1), 109–119. https://doi.org/10.1109/TC.2007.250627
    18. Tversky, A., & Kahneman, D. (1971). Belief in the law of small numbers. Psychological Bulletin, 76(2), 105–110. https://doi.org/10.1037/h0031322
    19. Vitter, J. S. (1985). Random sampling with a reservoir. ACM Transactions on Mathematical Software, 11(1), 37–57. https://doi.org/10.1145/3147.3165
    20. Wichmann, B. A., & Hill, I. D. (1982). Algorithm AS 183: An efficient and portable pseudo-random number generator. Applied Statistics, 31(2), 188–190. https://doi.org/10.2307/2347988
    STATS UNLOCK · statsunlock.com · Random Number Generator
    RELATED ARTICLES

    LEAVE A REPLY

    Please enter your comment!
    Please enter your name here

    Most Popular

    Statistical Models

    Important Plots & Charts

    Calculators and Converters