Free Random Number Generator — Crypto-Grade · Up to 1,000 Numbers
Pick a range, pick how many, pick whether duplicates are allowed — get cryptographic-grade random integers backed by `crypto.getRandomValues` whenever the runtime exposes it. Works for raffles, lotteries, gaming, sampling, and fairness-critical draws.
- Instant result
- Private — nothing saved
- Works on any device
- AI insight included
Random Number Generator
You might also need
What This Calculator Does
A random number generator answers a deceptively simple question: “Pick a number — fairly.”Give the calculator a range (a low and a high), tell it how many numbers you want, and decide whether duplicates are allowed. It hands back a list of integers chosen so that every value in the range has the same chance of appearing on every draw. That fairness sounds trivial — surely a computer can just “pick a number”? — but doing it without bias is one of the few problems where casual code routinely gets wrong answers, even on big-name websites. This tool uses the browser’s cryptographic RNG and rejection sampling to make the result statistically clean, not just plausible-looking.
Two modes cover the bulk of real-world use. In allow-duplicatesmode, each draw is independent — like rolling a die over and over, where rolling a 4 doesn’t prevent you from rolling another 4 next turn. In unique-only mode the calculator draws without replacement, like pulling lottery balls out of a tumbler — once a number comes out, it cannot come out again in the same run. The two modes look superficially similar but answer fundamentally different statistical questions, and using the wrong one is the most common RNG mistake we see.
Common uses are exactly what you would expect: tie-breaking when a coin feels too binary, picking a winner from a giveaway list, drawing lottery numbers for a casual pool, choosing a random sample for a statistics class, assigning subjects to A/B test buckets, generating seed numbers for tabletop games and roleplay, and producing the kind of “throwaway integers” that show up in code interviews and homework. Stick around — the worked examples below cover all three flavours, including the lottery-style draw where unique-only mode is the only correct choice.
How RNG Works Under the Hood
Computers cannot generate genuinely random numbers on their own — they are deterministic machines, and a deterministic machine producing “true randomness” is a contradiction. What they can do is produce pseudo-random sequences that pass every practical test for randomness, seeded by an unpredictable starting value. The quality of that seeding, and the algorithm that follows, is what separates a casual RNG from one you can lean on for high-stakes draws.
This calculator uses crypto.getRandomValues, the browser’s built-in cryptographically secure pseudo-random number generator(CSPRNG). It is the same source TLS handshakes use to generate session keys, the same source the Web Crypto API draws on for key generation, and the same source modern frameworks reach for whenever the integer needs to resist prediction. Under the hood it pulls entropy from the operating system’s pool — typically derived from hardware noise, interrupt timing, and other physical signals — and stretches that entropy through a vetted cryptographic primitive (commonly ChaCha20 or AES-CTR depending on the platform). The result is a stream of bytes no observer can predict without knowing the underlying state.
The contrast is Math.random, JavaScript’s legacy non-cryptographic PRNG. It is fast, statistically uniform enough for casual visualization, and absolutely unsuited for anything where prediction matters. Modern engines use a small-state algorithm (xoshiro, in V8’s case) that is great for a video-game dice roll but trivially reverse-engineered from a few outputs. If you are picking a giveaway winner where someone has a financial incentive to guess the seed, or running an audit-relevant lottery, the difference between these two sources matters enormously — even though both will look statistically uniform on a histogram.
The second subtlety is modulo bias. The naive way to map a 32-bit random integer onto a range like 1–100 is to compute (rand % 100) + 1. That looks fine, but it is wrong: 232 = 4,294,967,296 does not divide evenly by 100, so the first 96 values in the range get one extra chance to appear and the last 4 get one fewer. The bias is tiny for small ranges but blows up as your range size approaches the underlying integer size. The fix is rejection sampling: discard any random value that falls in the “leftover” region and draw again, until you land in a zone that maps cleanly onto the target range.
The probability of a single rejection is at most range / 2^32, which for any practical range size is vanishingly small — picking from 1 to 100, you reject roughly one draw in 43 million. The overhead is invisible to the user, but the correctness guarantee is absolute: every integer in the requested range has exactly the same probability of being returned, to floating-point precision. A surprising number of public RNG tools skip this step entirely; the result is a subtly biased distribution that only shows up under statistical testing or in adversarial scrutiny.
For unique-only mode the algorithm changes slightly. Instead of drawing-and-mapping each time, the calculator builds the candidate set and uses a Fisher–Yates shuffle — the same algorithm a fair card dealer’s mental model approximates — to permute the values, then takes the first nelements. Fisher–Yates is provably uniform over permutations, so every possible n-subset of the range has equal probability of being the result. That property is what makes the mode legitimately lottery-like rather than “mostly fair, with a couple of duplicates filtered out,” which is the biased shortcut you will see in less careful implementations.
How to Use This Calculator
- Enter the low and high bounds of your range. The calculator picks integers inclusive of both endpoints — so a range of 1 to 6 really means dice rolls from 1 through 6, with both 1 and 6 reachable.
- Enter the count— how many numbers you want returned. One number for a tie-break, six for a lottery pool, a hundred for a statistics sample, whatever the task calls for. There is no hard ceiling, but very large counts can stress the browser’s rendering rather than the RNG itself.
- Pick the mode. Toggle allow duplicates if each draw should be independent (dice-like, every draw resets the urn). Toggle unique only if the draws should be without replacement (lottery-like, each value can appear at most once). The default is duplicates-allowed because that is the more common ask.
- Hit Generate. The result list updates immediately. Each “Generate” press is a fresh independent draw — the previous result is not used as a seed, and there is no hidden “continue from last time” state. Press it again to get a completely new set.
- Read the result. Numbers are displayed in the order they were drawn (not sorted) so that ordering-sensitive uses — like ranked tie-breaks or sequential ticket-number assignment — preserve the natural reading order. Copy the list to your clipboard if you want to paste it elsewhere; the values are plain integers separated by commas.
Three Worked Examples
Three concrete scenarios, one for each common pattern. Try plugging them into the calculator above to confirm the behavior — they make the abstract rules above feel mechanical.
Example 1 — Pick 1 number from 1 to 100 for a tie-break
Two co-workers both want the same vacation week and HR has decided to settle it with a random draw rather than seniority. Set low = 1, high = 100, count = 1, mode allow duplicates (irrelevant for a single draw, but the default). Hit Generate. The calculator returns one integer — say, 73. You agreed in advance that whoever’s pre-picked number is closer to the result wins; co-worker A picked 60 and co-worker B picked 80, so B (distance 7) beats A (distance 13). Done.
This is the bread-and-butter use case: any time two parties need a verifiable, unbiased tie-break and don’t want the optics of one party flipping a coin, an RNG with a wide range produces a hard-to-game result. The wide range matters — picking from 1 to 10 instead of 1 to 100 means there are only ten possible outcomes, which is small enough that someone could plausibly preempt the result by claiming “I called 7 first.” A 100-wide range makes that claim implausible. For any other tie-break math, the percentage calculatorhandles proportional-share questions like “split the cost 60/40,” which is the non-random alternative.
Example 2 — 6 unique lottery numbers from 1 to 49
You and four friends are running a casual office lottery pool. The format mirrors a traditional 6/49 draw: pick six distinct numbers from the 1–49 range, no repeats. Set low = 1, high = 49, count = 6, mode unique only. Hit Generate. The calculator returns a list like [7, 23, 41, 4, 18, 32].
Unique-only mode is the right choice here because real lottery draws are physically without-replacement — a numbered ball that comes out of the tumbler does not get put back before the next ball is drawn. If you used allow-duplicates mode instead, you might end up with a list like [7, 7, 18, 32, 32, 41], which would be invalid as a lottery ticket. The Fisher–Yates shuffle inside the calculator guarantees that every one of the C(49, 6) = 13,983,816 possible 6-subsets has exactly equal probability of being returned. Note the cap: count cannot exceed range size (49 in this case), because you cannot pick more unique values than exist. Asking for 50 unique values from 1 to 49 is mathematically impossible, and the calculator will refuse rather than silently returning 49 values.
Example 3 — 100 numbers from 1 to 10, duplicates allowed
A statistics professor wants you to demonstrate the law of large numbers by drawing 100 independent samples from a uniform 1–10 distribution and computing the empirical mean. Set low = 1, high = 10, count = 100, mode allow duplicates. Hit Generate. The calculator returns a list of 100 integers — many of them repeated, because by the pigeonhole principle a 100-element list from a 10-element range must contain duplicates.
Allow-duplicates is mandatory here because each draw must be an independent sample from the same distribution — that independence is the assumption every elementary statistical theorem is built on. Compute the mean of the 100 values. The theoretical expectation for a uniform 1–10 distribution is (1 + 10) / 2 = 5.5; with 100 samples your empirical mean should land within a few tenths of that, with the gap shrinking as you increase the sample size. For follow-on arithmetic — the empirical mean, variance, or distribution spread — the average calculator handles the mean/median/mode part of the workflow, and the fraction calculatorhandles the proportional-share follow-ups (“what fraction of my draws were even numbers?”).
Common Mistakes
- Picking the wrong mode. Allow-duplicates and unique-only answer fundamentally different statistical questions. Allow-duplicates models independent repeated trials — every draw forgets every previous draw. Unique-only models sampling without replacement — every draw shrinks the remaining pool. Using allow-duplicates for a lottery produces invalid tickets; using unique-only for dice rolls produces a sequence that is provably non-independent (the second roll cannot equal the first). Match the mode to the underlying physical process you are trying to mimic.
- Asking for more unique values than the range contains. If your range is 1 to 10 (ten possible values) and you ask for 11 unique results, the calculator has to refuse — you cannot put eleven distinct integers into ten slots. The fix is either to widen the range (low = 1, high = 100, say) or to switch to allow-duplicates mode if the underlying task actually wants repeated draws.
- Treating the result as “truly random.” Even a CSPRNG is deterministic given its internal state. The output is computationally indistinguishable from random, which is a strong guarantee for almost every practical purpose, but it is not the same as the radioactive-decay-style randomness used in certified hardware RNGs. For audit-grade certified gambling, casino play, or government lotteries, a software RNG is usually not allowed by regulation — jurisdictions require certified hardware sources.
- Confusing inclusive and exclusive bounds.This calculator’s range is inclusive on both ends — a range of 1 to 6 includes both 1 and 6. Many programming languages default to exclusive upper bound (Python’s
range(1, 6)gives 1, 2, 3, 4, 5 with no 6). Mismatched conventions are how off-by-one bugs sneak into systems where one team writes the spec and another writes the code. When in doubt, ask “is the high value reachable?” explicitly. - Re-rolling until you get a result you like.If you press Generate ten times and pick the result that suits you best, the draw is no longer random — it is curated. The whole point of an RNG is to commit to the first result. For high-trust applications (giveaway draws, public tie-breaks), the convention is to share the screen, press Generate once, and accept what comes out — anything else turns the “random draw” into a guided choice with extra steps.
- Assuming consecutive results in a small list mean the RNG is broken. A truly random list of, say, 20 draws from 1–6 will almost certainly contain at least one pair of identical adjacent values. Humans systematically expect random sequences to be more “mixed” than they actually are; mathematicians call this the clustering illusion. The list looking “not random enough” is usually evidence that it is genuinely random, not the other way around.
- Using
Math.randomfor adversarial contexts. If you write your own RNG code rather than using this calculator, do not reach forMath.randomwhen the result has any value to predict — coupon codes, raffle IDs, password reset tokens, anything someone might game. The fix is one line:crypto.getRandomValuesinstead. The performance difference is irrelevant; the security difference is enormous.
When This Calculator Decides For You
Random numbers are usually inputs into a real decision rather than the end of the thought. The five most common decisions the result drives:
- Settling a tie-break that needs to feel fair to all parties. Two siblings arguing over the front seat, two co-workers competing for the same vacation week, two startups bidding for the same contract slot when their offers are otherwise tied. A wide-range RNG draw with a screen-share is the fairest practical resolution short of paying for a notarized lottery — every party sees the same input and the same output, and there is no plausible way to game it.
- Picking a giveaway or raffle winner from a numbered list.You have 1,247 entrants in a competition. Number the entries 1 through 1,247, set the calculator to unique-only mode, and ask for as many winners as you have prizes. Record the result and publish the list publicly — that combination of fairness plus transparency is what makes a giveaway feel legitimate to the people who didn’t win.
- Drawing lottery-style numbers for a casual office or family pool.Six unique numbers from 1–49, five from 1–69 plus a powerball, twenty bingo numbers from 1–75 — the format varies but the algorithm is the same. Unique-only mode is non-negotiable for any draw modeled on real ball-tumbler lotteries. Pair the result with the ratio calculator if you need to split the prize unevenly between participants.
- Assigning subjects to A/B test buckets.Marketers and product teams frequently need to split a list of users into two or more equal-probability buckets for experimentation. Generate one random integer per user (range 1–100, say) and bucket by ranges (1–50 → A, 51–100 → B). The CSPRNG quality matters here because biased bucket assignment will produce statistically wrong A/B test results, even if the bias is only a percentage point.
- Picking a random sample for a statistical study.Survey research, quality-control inspection, scientific sampling — anywhere you need a fair subset of a known population — wants unique-only mode with count = sample size, range = population size. The Fisher–Yates shuffle inside the calculator gives every possible subset equal probability, which is the formal definition of a simple random sample.
What This Calculator Doesn’t Model
Honesty matters more than feature lists. The tool is deliberately narrow, and there are five things it does not try to do.
- Audit-grade certified randomness.Regulated gambling, state-run lotteries, and many forms of clinical-trial randomization require RNGs certified by an independent testing lab (eGaming Labs, GLI, BMM Testlabs) and often physical hardware sources. This calculator’s output is statistically and cryptographically excellent, but it carries no certification — using it for anything legally regulated is the wrong tool for the job. For those use cases, hire a certified provider.
- Reproducible “random” sequences from a seed. Some tasks — procedural game generation, simulation reproducibility, scientific computing where you need to rerun the same experiment — want a sequence that looks random but is regenerable from a seed value. That is a seeded PRNG (Mulberry32, PCG, xorshift, the Mersenne Twister), not a CSPRNG. This calculator deliberately does not expose a seed input because the whole point of the CSPRNG path is that the state is unpredictable.
- Non-uniform distributions.Every value in the range has equal probability of being chosen — that is the uniform distribution. Tasks that want a weighted draw (“pick 1 with 70% probability and 2 with 30%”), a normal/Gaussian distribution, an exponential distribution, or any other shape need a different tool. The standard recipe is to draw a uniform value first and then transform it (inverse-CDF sampling), but that transformation is not built into this calculator.
- Floating-point or arbitrary-precision results.The output is always integers. If you need a random decimal between 0 and 1, a random angle between 0 and 2π, or a random 256-bit hex string, this is the wrong tool. Most of those use cases are downstream transformations of a uniform integer draw, but the transformation step belongs in your own code.
- Cross-device or cross-session coordination.Each draw is local to the browser tab that produced it. Two people pressing Generate at the same moment will get different results — there is no shared server, no synchronization, and no way to verify remotely that “you and I both got 42 from the same draw.” For shared-randomness protocols (commit-reveal schemes, verifiable random functions), the cryptography is more involved and lives outside a single-page calculator.
For broader math workflows that often start with a random draw — computing the average of a sample, splitting a total in a given ratio, or converting raw counts to a percentage — pair this generator with the rest of the toolbox at the math calculators page. The average calculator is the natural follow-up for stats-class samples, the percentage calculator handles share-of-whole conversions for bucket-assignment summaries, the ratio calculator handles weighted splits across winners, and the fraction calculator cleans up the “what fraction of my draws were X” question that almost always comes next.
Sources & Methodology
The formulas, thresholds, and benchmarks behind this calculator are anchored to the primary sources below. Where a study or agency document is the underlying authority, we link straight to it — not a summary or republished version.
- NIST SP 800-90A Rev. 1 — Recommendation for Random Number Generation Using Deterministic RBGs· National Institute of Standards and Technology
Federal standard governing deterministic random-bit generation used as the methodology baseline for cryptographically sound RNGs.
Accessed
- NIST SP 800-22 — Statistical Test Suite for Random and Pseudorandom Number Generators· National Institute of Standards and Technology
Federal test-suite specification used to validate uniform-distribution properties of pseudo-random number outputs.
Accessed
- RFC 4086 — Randomness Requirements for Security· Internet Engineering Task Force
Internet-standard reference on entropy sources, seeding, and the distinction between pseudorandom and true-random number generation.
Accessed
- Knuth — The Art of Computer Programming, Vol 2: Seminumerical Algorithms (3rd ed.)· Stanford University / Addison-Wesley
Canonical academic reference covering pseudo-random number generation algorithms (linear congruential, Mersenne Twister) and their statistical properties.
Accessed
- ECMA-262 — ECMAScript Math.random Specification· Ecma International
International standard defining the Math.random behavior in ECMAScript that browsers implement under the calculator's runtime.
Accessed
Frequently Asked Questions
The most common questions we get about this calculator — each answer is kept under 60 words so you can scan.
Is this 'truly' random?
When your browser exposes `crypto.getRandomValues` (every browser since Chrome 11 / Firefox 21 — i.e. effectively all of them), the calculator pulls bytes from the OS-level cryptographic random pool. That's the same source bcrypt, signing keys, and TLS handshakes use. When crypto is unreachable (very old runtimes), it falls back to `Math.random` — fine for casual use, not for crypto. The result panel labels which source ran.What about modulo bias?
When mapping random bytes onto a finite range, naive `bytes % range` gives slightly-non-uniform output if range doesn't divide evenly into 2^32. The calculator uses rejection sampling — it discards draws above the largest multiple of `range` that fits in 2^32, then takes mod. This produces uniformly distributed integers with zero bias, at the cost of a tiny percentage of rejected draws.Can I generate decimals or ranges with decimals?
Not in this version — the calculator returns integers in `[min, max]` inclusive. For decimals, multiply your inputs (1.0 to 5.0 = generate 10 to 50 then divide by 10 in your head). Decimal RNG is a different problem (uniform on [0,1) with quantization concerns) and out of scope here.What's the difference between 'allow duplicates' and 'unique only'?
Allow duplicates = independent draws. Each call samples independently — same number can repeat (rolling 4 dice; values can collide). Unique only = sampling without replacement. Each value comes out at most once — like drawing playing cards or lottery balls. Behind the scenes, unique-only mode does Fisher-Yates partial shuffle when count is a meaningful fraction of the range, and rejection-sampling into a Set when count is sparse.Why is the unique-only mode capped at the range size?
Because you can't pick more unique numbers than exist. Range [1, 10] has 10 distinct values; asking for 15 unique draws is impossible. The calculator returns an explicit error rather than silently wrapping or duplicating. Loosen by either expanding the range or enabling 'allow duplicates'.Is this random enough for a giveaway / lottery?
For low-stakes casual draws (Twitter giveaway, classroom raffle, friend group fairness), yes — `crypto.getRandomValues` on any modern browser exceeds the unpredictability needs. For regulated lotteries, gambling commissions, or money-on-the-line draws, you must use a certified RNG that's been audited and produces a verifiable random beacon. The label on the result panel tells you which source ran; legal compliance is your responsibility.Can I save the seed for reproducibility?
Not from cryptographic random — the whole point is unpredictability, so there's no recoverable seed. For reproducible 'random' (e.g. simulation), you want a seeded PRNG like Mulberry32 or PCG, which this calculator deliberately does not provide. The calculator's job is unpredictable randomness; reproducibility is a different need.Why does the same set of inputs produce different output every time?
Because that's literally what 'random' means. Each click reads fresh bytes from the cryptographic pool. Reload the page or click again — you'll see a new sample. If you need to capture a specific result for a contest, screenshot it and save the timestamp; nothing in the calculator persists state.Can I use this to break ties?
Yes — that's a perfect use case. Set min=1, max=N (number of options), count=1. The output is one uniformly-chosen integer to break the tie. For 'pick which restaurant tonight,' min=1, max=4, count=1 produces an unbiased verdict. Faster than a coin flip when there are more than two options.What's the largest range supported?
min/max can range from −1,000,000,000 to +1,000,000,000. The internal arithmetic uses 32-bit unsigned integers under crypto-RNG, which supports a range up to ~4.3 billion — well above the input cap. Math.random fallback supports the full range too. The 1,000-number count cap is a UI/performance limit, not a math limit.How is this different from picking numbers in a spreadsheet?
Excel/Sheets `RAND()` and `RANDBETWEEN()` use Math.random-class PRNGs — fine for stats but not cryptographic. They also re-randomize on every recalc, which is annoying. This calculator commits to one draw per click and uses a CSPRNG when possible. For cryptographic use cases (password generation, token IDs, audit-grade selections), the difference matters.Can I generate a UUID or random string with this?
Not directly — the calculator returns integer arrays. For UUIDs, use `crypto.randomUUID()` in your browser console (built-in). For random alphanumeric strings, generate integers in [0, 35], then map to characters. The calculator does the math layer; format conversion is one line of code on top.