HomeGuides › Random Numbers

How Random Number Generators Work

Last updated: September 2026 · Independently QA-tested formulas

Quick answer: A random number generator picks a number where every value in your range is equally likely. Online tools use a seeded pseudo-random algorithm — unpredictable in practice for games, draws and picks, though not cryptographic-grade.

Give me a number between 1 and 10, right now. Whatever you said, you didn't pick randomly — humans avoid round numbers, favor 7, and lean on recent memories. Computers are different: they produce sequences that pass statistical tests for randomness, which is exactly what a random number generator does for picks, draws, dice and raffles.

What is a random number generator?

An RNG is a procedure that outputs values with no usable pattern. Two families exist:

For picking a raffle winner or rolling a d20, a PRNG is exactly as fair as a physical die — arguably fairer, since a worn die is biased.

How a range pick works: the formula

value = min + floor(rand() × (max − min + 1))

Where rand() returns a uniform decimal in [0, 1). Multiplying stretches it across your range, flooring snaps it to whole numbers. Three properties matter:

Worked example: rand() returns 0.2719, range 1–100 → 1 + floor(0.2719 × 100) = 28.

What is a seed?

The seed is the PRNG's starting state. Same seed in, same sequence out — that's how scientists re-run identical simulations. Everyday tools seed from the system clock or OS entropy, so you never see repeats of the same sequence. If a tool lets you set a seed, use it only when you want reproducibility.

Can numbers repeat?

Yes — and they should. Independent draws mean yesterday's result has zero effect on today's. In a 1–10 range, a repeat appears within about 7 picks on average. That feels "unrandom" to humans (the gambler's fallacy) but is mathematically correct. Tools labeled "unique picks" or "no repeats" instead sample without replacement, like dealing cards.

Common uses and how to set them up

Use caseSetup
Raffle / giveaway winnerNumber each entrant, generate one value from 1 to N
Dice replacementMin 1, max = sides; one draw per die
Lottery-style pickUse no-repeat mode with your game's range
Prize draw with 3 winnersGenerate 3 unique values from 1 to N (or re-roll duplicates)
Sampling for a surveyNumber the population, draw k unique values

Uniform vs weighted: when equal odds are the wrong answer

Every tool on this page is a uniform generator: each number in the range has exactly the same chance. That is what raffles and dice need — but not everything. Some real picks are weighted:

Randomness myths that cost people money

A security boundary you should know

PRNGs like Math.random() are ideal for dice, raffles and games — unpredictable enough that nobody can guess your next roll in practice. They are not designed to resist a determined attacker choosing passwords. Password generation needs a cryptographically secure source (CSPRNG), which is why our password generator exists separately from this one. The password entropy guide explains the math of why a 16-character passphrase beats an 8-character string of symbols.

The 2d6 curve: why some dice totals are rarer than others

One honest limitation of "pick a number from 1 to 36" for dice replacement: it gives a flat distribution, while real two-dice throws are peaked. Every one of the 36 (die, die) combinations is equally likely, but a total of 7 has six of them (1+6, 2+5, 3+4, 4+3, 5+2, 6+1) while 2 or 12 have one each:

Total23456789101112
Ways out of 3612345654321

So 7 comes up about 16.7% of the time — six times as often as snake eyes. Board games that "feel wrong" are usually just revealing this curve. For a dice game where the shape of the distribution matters, roll two dice separately (the dice roller does independent draws) rather than one uniform pick from the summed range.

Unique picks: how the odds actually change

Drawing with replacement keeps every draw at the same odds; drawing without replacement shifts them as the pool shrinks. A 6/49 lottery is the classic case: the first ball is a 1-in-49 shot, but the jackpot needs all six — 49 × 48 × 47 × 46 × 45 × 44 ÷ 720 orders = 1 in 13,983,816. That's C(49,6) — combinations, not permutations, because draw order doesn't matter.

The same combinatorics runs a raffle fairly: 150 unique picks from 200 entrants leaves the last entrant facing odds that rose from 1/200 toward 1/51 as others were drawn. Not unfair — just not the constant 1/200 your intuition keeps quoting. When fairness must be visible, publish the method: numbered entrants, unique-mode draw, order ignored.

Frequently Asked Questions

Is a 50/50 coin flip really 50/50?

A simulated coin flip is — each draw is uniform. Physical flips are slightly biased toward the side that starts facing up, research suggests around 50.8% for a standard flip.

Can I predict the next number?

Not without knowing the internal seed and state. For our tools' purposes (picks, dice, draws), the sequence is unpredictable.

Why do my dice rolls never total the average?

Average results are typical, not guaranteed. Three d6s average 10.5, but any total from 3–18 is possible; extremes are simply rarer. Try the dice roller and watch the spread over many rolls.

Is randomness fair for giveaways?

Yes, provided every entrant maps to exactly one number and the range covers all of them — the team randomizer handles the grouping for you.

Try the calculators

← All guides · Glossary · Methodology