Random Number Generator
Generate random integers or decimals within any range. Generate single or multiple numbers at once.
Quick Presets
Settings
🔐 Using window.crypto.getRandomValues(), cryptographically secure · All calculations run locally in your browser.
What Is the Random Number Generator?
This random number generator supports three distributions (uniform, normal, exponential), integer or decimal output, unique-value mode, cryptographic security, and seeded reproducibility. Generate up to 10,000 numbers in a single click. Results include a frequency histogram, statistical summary (min, max, mean, median, std dev), and CSV/JSON export.
- ›Quick presets: D6, D20, D100, coin flip, 1–100, percentage
- ›Cryptographic mode uses window.crypto.getRandomValues(), suitable for security applications
- ›Seeded mode with Mulberry32 PRNG, same seed always produces the same sequence
- ›Frequency histogram appears for 10+ numbers
- ›Export results as CSV or JSON files
Formula
Supported Distributions
Uniform
P(x) = 1/(max−min)
Equal probability for all values
Normal
P(x) = (1/σ√2π)e^(−½((x−μ)/σ)²)
Bell curve, Box-Muller transform
Exponential
P(x) = λe^(−λx)
Inverse CDF method
- ›Cryptographically secure mode uses
window.crypto.getRandomValues() - ›Seeded mode uses Mulberry32 PRNG, reproducible given the same seed
- ›Unique mode: Fisher-Yates on the integer range, no repeated values
How to Use
- 1Choose a quick preset (D6, D20, etc.) or set your own min/max range
- 2Set "How many" to 1 for a single number, or up to 10,000 for bulk generation
- 3Choose integer or decimal output; for decimal, select decimal places
- 4Click Generate, a single large number or a grid of numbers appears
- 5For 10+ numbers: a statistical summary and histogram are shown below
- 6Use Advanced Options to enable unique values, normal/exponential distributions, or seeded generation
Example Calculation
Generate 5 unique integers between 1 and 49 (lottery numbers):
Type: Integer, Unique: on
Result: 7, 14, 23, 31, 42
Simulating dice rolls
Use the D6 preset to simulate a six-sided die. Click Generate repeatedly to roll. For multiple dice (e.g. 2d6), set count to 2 and min=1, max=6. The mean of many rolls will converge to 3.5 (the expected value of a fair die).
Understanding Random Number Generator
Random Number Generation Methods
| Method | Quality | Speed | Use case |
|---|---|---|---|
| crypto.getRandomValues() | Cryptographic | Fast | Passwords, tokens, security |
| Mulberry32 (seeded) | Statistical | Very fast | Reproducible simulations |
| Math.random() | Statistical | Very fast | General use (legacy) |
Frequently Asked Questions
What is a cryptographically secure random number?
Cryptographic randomness is important for passwords, tokens, and any security-sensitive application. The standard Math.random() is not suitable for these uses.
- ›window.crypto.getRandomValues() uses OS entropy from hardware sources
- ›Passes statistical randomness tests (NIST SP 800-22)
- ›Math.random() is faster but predictable given the internal state
- ›This tool defaults to crypto mode for maximum quality
What is a seeded random number generator?
Seeded generation trades true randomness for reproducibility. The Mulberry32 algorithm is fast and passes statistical tests, but is not cryptographically secure.
- ›Same seed → same sequence, every time
- ›Mulberry32: 32-bit state, excellent statistical properties
- ›Useful for: reproducible Monte Carlo simulations, game seeds, test data generation
- ›NOT suitable for passwords or security tokens
What distributions are supported?
Each distribution has a different shape and is used in different simulation contexts.
- ›Uniform: all values in [min, max] equally likely, dice, lotteries
- ›Normal (Gaussian): values cluster around the mean, heights, test scores, measurement errors
- ›Exponential: most values are small, few are large, wait times, radioactive decay
- ›Normal uses Box-Muller transform; exponential uses inverse CDF method
What is unique mode?
Unique mode is equivalent to sampling without replacement from the integer pool. It requires integer mode and that the count does not exceed the pool size.
- ›Every number in the output is distinct
- ›Requires count ≤ (max − min) integers in the range
- ›Uses Fisher-Yates shuffle for an unbiased selection
- ›Common uses: lottery numbers, raffle draws, unique IDs
How do I export the results?
Export options let you save and use the generated numbers in other tools.
- ›CSV: "index,value" format, opens directly in Excel or Google Sheets
- ›JSON: includes min, max, count, distribution, and numbers array
- ›Copy: copies the comma-separated list to the clipboard
- ›Both formats download as files immediately
What is the maximum number of values I can generate?
The 10,000 limit balances capability with browser performance. Generation is done in a single synchronous pass so it completes instantly even for large counts.
- ›1–1 numbers: shown as a large display
- ›2–200 numbers: shown as a grid of badges
- ›201–10,000 numbers: summarised with first 10 visible + statistics
- ›Histogram appears for 10+ numbers regardless of display mode
What do the statistics (mean, median, std dev) tell me?
The statistics panel helps verify that the generator is working correctly and the distribution matches expectations.
- ›Uniform [1,100]: expected mean = 50.5, std dev ≈ 28.87
- ›Normal (μ=50, σ=15): expect mean ≈ 50, std dev ≈ 15
- ›The law of large numbers: with 1000+ samples, observed stats approach theoretical
- ›Min and max converge to the range boundaries with large samples