Online Random Number Generator
Distribution of results
Uniformity test
Draw more numbers in a narrower range to run the test.
Recent draws
Saved presets
How does the Random Number Generator work?
The generator gives you two sources of randomness, and you choose which one fits the job.
Secure random draws entropy from your operating system through the Web Crypto API (crypto.getRandomValues()). It is unpredictable and unrepeatable — the right choice for a real draw where nobody should be able to guess the outcome in advance.
Seeded turns any text you type into a starting state for a deterministic generator (xoshiro128**). The same seed always produces the same numbers, so anyone can replay your draw and confirm you got what you say you got.
Both run entirely in your browser. No number ever reaches a server.
No modulo bias
Most simple generators map a random 32-bit value onto your range with value % range. When the range does not divide evenly into 2³², the lowest numbers come up slightly more often than the rest. Over thousands of draws it is measurable.
This generator uses rejection sampling instead: values that would fall into the uneven tail are thrown away and redrawn. Every number in your range has exactly the same chance. You can verify it yourself with the built-in uniformity test.
What the generator can do
Range
- Minimum and maximum — any whole or decimal range, negative values included
- How many numbers — from 1 up to 1,000,000 in one draw
- No repeats — every number appears at most once, the way a real draw works
- Sort — draw order, ascending, or descending; sorting never touches the randomness
- Step — restrict results to multiples of a value, so only 0, 5, 10, 15 come up
- Exclude numbers — list values that must never be drawn
Mode
- Source of randomness — secure (Web Crypto) or seeded (reproducible)
- Seed — any text; the same seed always replays the same draw
- Distribution — uniform, normal (Gaussian), exponential, Poisson, triangular, binomial
- Weights — give chosen numbers a higher chance, written as
number:weight - Dice notation —
3d6+2,d20,2d20kh1for advantage,4d6dl1for rolling stats
Output
- Separator — comma, space, semicolon, tab, new line, or anything you type
- Number system — decimal, binary, octal, hexadecimal, or base 36
- Pad with zeros — turn 7 into 007 for ticket or ID numbers
- Prefix and suffix — wrap every number in fixed text
- Template —
{n}is the number,{i}its position, souser{n}becomesuser42 - Copy as — plain text, CSV, JSON, or a Markdown table
Statistics
Every draw is summarised live: sum, mean, median, lowest, highest, standard deviation, plus how many results are even, odd, or prime. A histogram shows the shape of the distribution, and a chi-square test tells you whether the results actually match a uniform distribution.
History
The last 50 draws are kept in your browser, with the settings that produced them — one click restores any of them. Configurations you use often can be saved as named presets, and the whole lot exports to a JSON file you can import on another machine. Nothing is stored anywhere but this browser.
Keyboard
Press Space or R to draw again without reaching for the mouse.
Quick presets
| Preset | Range | Count | Usage |
|---|---|---|---|
| 🎲 Dice | 1–6 | 1 | Board games, deciding |
| 🪙 Coin | 0–1 | 1 | Heads or tails |
| 🎰 Lottery | 1–49 | 6 | Unique, sorted, like a real draw |
| 💯 1–100 | 1–100 | 1 | Percentages, A/B splits |
| 🔢 PIN | 0–9 | 4 | Four digits, repeats allowed |
Reproducible draws
Seeded mode exists for the moments when “trust me, it was random” is not enough.
Pick a seed everyone can agree on in advance — a date, a hashtag, the closing price of something public — and announce it before you draw. Anyone can then type the same seed with the same settings and get the identical result. You have not proved the numbers were unpredictable; you have proved you did not reroll until you liked the answer.
It is also how you make randomness repeatable in work that has to be checked: a sampling plan a colleague can rerun, a set of test fixtures that stays stable across a test suite, a classroom exercise where every student gets the same “random” data.
Choosing a distribution
Uniform gives every number in the range the same chance. It is what people usually mean by random, and it is the default.
The others cluster results around a value, which is what real-world quantities tend to do:
- Normal (Gaussian) — heights, measurement errors, test scores. Set a mean and a standard deviation.
- Exponential — waiting times between independent events.
- Poisson — counts of events in a fixed interval: arrivals per hour, defects per batch.
- Triangular — when you know the minimum, maximum, and most likely value but nothing else. Common in project estimates.
- Binomial — successes out of a fixed number of trials at a fixed probability.
Every distribution is clipped to the range you set, so a long Gaussian tail cannot escape your minimum and maximum.
Where random numbers get used
Games and entertainment
- Board games — dice rolls, turn order
- Tabletop RPGs —
4d6dl1for ability scores,2d20kh1for advantage - Giveaways — picking a winner, with a seed so entrants can verify it
- Quizzes — random question order
Statistics and science
- Sampling — drawing a sample from a population without repeats
- A/B testing — assigning participants to groups
- Monte Carlo simulation — estimating probability by repetition
- Bootstrapping — resampling to estimate uncertainty
Development
- Test data — a million values, generated in the background so the page stays responsive
- Fixtures — seeded, so a failing test fails the same way twice
- Random IDs — with padding, prefixes, or a template
- Load testing — templated identifiers like
user{n}@example.com
True vs. pseudorandom numbers
Math.random() | crypto.getRandomValues() | Seeded (xoshiro128**) | |
|---|---|---|---|
| Type | Pseudorandom | Cryptographically secure | Pseudorandom, deterministic |
| Entropy source | Engine-chosen seed | System CSPRNG | Your seed text |
| Predictable? | Potentially | No | Yes, by design |
| Repeatable? | No | No | Always |
| Good for security | No | Yes | No |
| Good for statistics | Depends | Yes | Yes |
| Good for verifiable draws | No | No | Yes |
Math.random() is not used anywhere in this tool.
Draws without repetition
With No repeats enabled, each number in the range appears at most once. Ideal for:
- Giveaways — nobody can win twice
- Permutations — shuffling a set of items
- Bingo — calling numbers that stay called
- Lottery — six distinct numbers from 1 to 49
The draw uses a partial Fisher–Yates shuffle, so asking for 6 numbers out of a million is as fast as asking for 6 out of 49 — it never loops hoping to avoid a collision. If you ask for more unique numbers than the range can supply, the generator says so instead of hanging.
Exporting results
Copy the numbers as plain text with any separator you like, as CSV for a spreadsheet, as JSON for code, or as a Markdown table for documentation. Very large draws stay in memory in full and copy in full, even though only the first couple of thousand are drawn on screen.
Generating random numbers in your own code
JavaScript / TypeScript
// Cryptographically secure integer in [min, max], without modulo bias.
// The naive `value % range` favours low numbers when range does not
// divide 2**32 evenly - so we reject values in the uneven tail.
function randomInt(min, max) {
const range = max - min + 1;
const limit = Math.floor(0x100000000 / range) * range;
const arr = new Uint32Array(1);
let value;
do {
crypto.getRandomValues(arr);
value = arr[0];
} while (value >= limit);
return min + (value % range);
}
Python
import random
import secrets
# Cryptographically secure, no modulo bias
n = secrets.randbelow(max - min + 1) + min
# Reproducible: the same seed always gives the same sequence
rng = random.Random('my-seed')
n = rng.randint(min, max)
# Without repetition
sample = random.sample(range(min, max + 1), count)
PHP
// Cryptographically secure (PHP 7+), no modulo bias
$n = random_int($min, $max);
// Reproducible
mt_srand(crc32('my-seed'));
$n = mt_rand($min, $max);
Frequently asked questions (FAQ)
Is the result truly random?
In secure mode, yes. It comes fromcrypto.getRandomValues(), a cryptographically secure generator fed by your operating system's entropy pool. Results are uniformly distributed and unpredictable. Seeded mode is deliberately the opposite: it is reproducible, which is the point.
How many numbers can I generate at once?
Up to 1,000,000. Draws above 50,000 are calculated in a background worker so the page stays responsive, and the screen shows the first 2,000 with a count of the rest — copying still gives you everything.Can I generate negative numbers?
Yes. Set a negative minimum. The full range of JavaScript numbers works, including negative ranges on both ends.Does sorting affect randomness?
No. Numbers are drawn first and sorted afterwards. Sorting changes only the order you see them in.Will the same seed give the same numbers tomorrow?
Yes, and on any other device or browser. The seeded generator is fully deterministic and depends on nothing but your seed and settings.What does the uniformity test tell me?
It runs a chi-square test comparing how often each number actually came up against how often it should have. If the statistic stays below the critical value, the results are consistent with a uniform distribution. It needs a reasonably narrow range and enough draws — at least five per possible value — to say anything meaningful.How do weights work?
Write them asnumber:weight pairs, for example 1:5, 2:1, 3:1. Here 1 is five times as likely as 2 or 3. Numbers you do not list get a weight of zero and are never drawn.
What dice notation is supported?
3d6 rolls three six-sided dice. Add a modifier with 3d6+2. Keep or drop dice with kh, kl, dh, dl — so 2d20kh1 keeps the highest of two d20s (advantage) and 4d6dl1 drops the lowest of four d6s.