Random Number Generator
Draw unbiased numbers, roll dice or pick winners from a list, using the browser's cryptographic random source with rejection sampling so every outcome is equally likely.
Each die is rolled independently, so the same face can appear on several dice.
Blank lines are ignored. Entries may repeat if the same name is genuinely listed twice.
Choose a mode and press Generate.
crypto.getRandomValues() and rejection sampling. Nothing is sent to a server,
nothing is stored, and the page keeps working offline.
How it works
Every value on this page comes from crypto.getRandomValues(), the API that exposes the operating
system's cryptographically secure random number generator to JavaScript. That is the same class of source browsers
use for TLS session keys and password resets. The tool deliberately never calls Math.random(), which is
a fast pseudo-random generator: its output looks random, but its internal state can be reconstructed from a modest
number of observed values, so it is unsuitable for anything where someone might want to predict the result.
Secure randomness on its own is not enough, because of a subtle trap called modulo bias. The API
returns unsigned 32-bit integers, that is, values from 0 to 4,294,967,295. The obvious shortcut is to compute
value % range. When range does not divide that total evenly, the lowest
4,294,967,296 % range outcomes are produced one extra time each, so they become slightly more likely
than the rest. For a six-sided die the bias is about one part in 700 million - invisible in casual use, but real,
and exactly the kind of quirk that turns into a scandal when money or selection is involved.
This tool uses rejection sampling instead. It computes the largest multiple of the requested range
that fits inside the 32-bit space, keeps random values below that limit, and throws the rest away to be redrawn.
The discarded values are never folded back into the result with a modulo operation, so the remaining values split
into exactly equal buckets and every outcome has probability 1 / range. On average fewer than two
extra draws are needed per value, so the cost is negligible.
The precision of a range is capped at 232 distinct outcomes - roughly four billion - and at 253 for decimal ranges, which is the limit of exact integer arithmetic in JavaScript numbers. That is far more resolution than any real draw needs, but it is the reason the tool warns instead of quietly rounding when you ask for a very fine decimal range across a very wide interval.
Accuracy, assumptions and limits
Uniformity is the whole of what this tool claims. It does not claim to be unpredictable to someone who controls your device: the security of the underlying generator belongs to your operating system and browser, and a compromised machine or a malicious extension can observe anything the page can observe. For a high-stakes public draw, software alone never proves fairness - you need witnesses and an auditable process.
- Uniform does not mean evenly spread. If you generate ten numbers between 1 and 10, seeing 7 twice and 3 not at all is not a bug. It is what genuine randomness usually looks like, and it is the pattern most people mistakenly expect to be "wrong".
- No-clone mode needs room. Drawing without duplicates fails when the range holds fewer distinct values than you asked for, so the tool reports the pool size rather than repeating a value.
- Decimal ranges are discrete, not continuous. "Between 0 and 1 with two decimal places" means 101 equally likely values, not an infinite continuum. If the requested precision would exceed the internal sampling limit, the tool says so instead of producing a subtly distorted distribution.
- Excluding past winners is independent. Each press of Generate is a fresh draw from whatever remains. Excluding winners changes the pool, not the odds of any single remaining entry, and there is no memory beyond the current page session.
How to use it
- Numbers. Set the minimum and maximum, choose how many results you want (1 to 100), then pick whole numbers or decimals. Decimals reveal a decimal-places control; whole numbers ignore it. Tick allow duplicates for independent draws such as simulating a set of measurements, and leave it off when each value must be unique, as in a raffle or a random sample. Tick sort ascending if you want the output ordered for reading or pasting into a spreadsheet.
- Dice. Choose a die from D4 to D100 and how many to roll. The individual faces are listed in the order rolled along with the total, which is what you want for a damage roll or a quick tabletop check. Leave the sorting option off if the order of the dice matters.
- Pick from a list. Paste one entry per line, set how many winners you need, and press Generate. With exclude previous winners enabled, the tool remembers what has already been drawn, so you can press Generate repeatedly to work through a list without repeats; the running log and the remaining count tell you how much of the list is left. Reset pool returns every entry to the hat.
- Keep a record if it matters. Use Copy results to place the current output on your clipboard as plain text. Because nothing is stored anywhere, closing the tab discards both the results and the pool.
A quick test you can run yourself: generate several thousand numbers between 1 and 6 with duplicates allowed and
count the faces. They will land within a fraction of a percent of each other - a distribution you cannot get from
Math.random() with a naive modulo step.
Frequently asked questions
Is this random number generator truly random?
It is uniformly random, which is the property that matters. Every value is drawn from crypto.getRandomValues(), the operating system's cryptographically secure random source, and values outside a whole multiple of the requested range are discarded and redrawn (rejection sampling). The result is that each outcome has exactly the same probability - there is no modulo bias. It is not a physical entropy source such as dice or radioactive decay, but it is the strongest randomness a web page can obtain.
Why can't I generate more numbers than the range allows?
Because you asked for no duplicates. Drawing without replacement from a range of five values cannot produce six distinct results, so the tool tells you the pool size instead of silently repeating a number. Either raise the maximum, lower the count, or allow duplicates.
Is this good enough for a lottery draw?
For a private draw among friends, yes - the selection is uniform and nobody can predict the order. For a regulated public lottery you would still want witnesses, a published algorithm and a tamper-evident audit trail, because the trust comes from the process rather than from the software. This tool cannot prove to a third party that the numbers were drawn fairly.
Does the tool send my list anywhere?
No. The names you paste are held in a variable in the page's memory while the tab is open, used for the draw, and discarded when you close or reload the page. The page makes no network requests at all, so it keeps working with your Wi-Fi turned off.
Sources & further reading
- MDN - Crypto.getRandomValues() — Documents the browser API used here, including the caveat that values computed modulo a range are biased unless whole multiples are rejected.
- NIST SP 800-63B - Digital Identity Guidelines — Its discussion of random value generation and look-up secrets is a concise statement of why security-relevant values must come from an approved random source rather than a general-purpose PRNG.
- OWASP Authentication Cheat Sheet — Explains how predictable random values undermine tokens and one-time codes, which is the same failure mode a biased number generator would introduce here.