Random Number Generator
Generate cryptographically secure random integers or decimals. Uniform or normal distribution, dice and lottery presets, exclude lists, multi-base output, live statistics, and a 10-roll history.
- Runs in browser
- No signup
- No tracking
How to use Random Number Generator
Pick a preset or set integer/decimal mode manually.
Set range, count, and (optional) distribution.
Add exclusions, choose a base, format the output.
Generate. Read stats. Copy or export CSV.
When to use it
Dungeon Master rolling d20s without a physical die.
Raffle and lottery draws with verifiable uniqueness.
Sampling rows from a list by index, with exclusions for already-picked rows.
Generating realistic test data with normal distribution.
Seeding fuzz tests with hex or binary random IDs.
What it fixes
`Math.random()` failing security or fairness audits.
Modulo bias skewing distribution at small ranges.
Uniform RNGs producing unrealistic fixture data — normal distribution fixes this.
Duplicates ruining a raffle when you needed unique winners.
About Random Number Generator
A real random number generator uses a CSPRNG, not `Math.random()`. This one uses the Web Crypto API (`crypto.getRandomValues`) with rejection sampling to avoid the modulo bias that naïve `% range` introduces. For normal distribution, it uses the Box–Muller transform.
Advanced controls cover the long tail: dice presets (d4 through d100), coin flips, lottery picks, exclude lists, unique mode without replacement, output in hex/binary/octal, custom separators, prefix/suffix wrapping, group-per-line formatting, CSV export, and a live stats panel (sum, mean, median, min, max, standard deviation).
References: MDN — Crypto.getRandomValues · Wikipedia — Modulo bias · Wikipedia — Box–Muller transform
Frequently asked
Is this cryptographically secure?
Yes. We use `crypto.getRandomValues` (Web Crypto API) with rejection sampling to avoid modulo bias. `Math.random()` is not used anywhere in the pipeline.
What's the difference between uniform and normal distribution?
Uniform gives every value in the range an equal chance. Normal (Gaussian) clusters values around a mean with a configurable standard deviation — most picks land near the mean, with extremes increasingly rare. Useful for simulating realistic data.
What does 'unique' mode do?
Picks distinct integers, never repeating. For uniform distribution, this is exact (Fisher–Yates shuffle on the eligible pool). For normal distribution, it retries until count distinct values are accepted.
Can I exclude specific numbers?
Yes. Type them comma- or space-separated in the Exclude field (e.g. `13, 17, 42`). The generator skips them and retries to fill your count.
What output formats are supported?
Decimal, hex (`0x...`), binary (`0b...`), and octal (`0o...`) for integers. Choose separator (newline, comma, space, custom), group into batches per line, and add a prefix or suffix to each value.
What are the presets for?
Quick configs for common rolls: dice (d4–d100), coin flip, lottery (6 of 49), percent. Pick one, click Generate.
Discussion
Related tools
All toolsUUID Generator
Generate UUID v4 (random) or UUID v7 (time-ordered) in bulk. Crypto-secure, in-browser.
GeneratorsPassword Generator
Cryptographically secure password and passphrase generator with entropy meter.
GeneratorsQR Code Generator
Generate QR codes for URLs, text, Wi-Fi, and vCards. Custom colors, PNG and SVG download.
Generators