Random Number Generator
Generate uniform random integers or decimals, normally-distributed (Gaussian) values, or a reproducible sequence from a seed — using your browser's cryptographically secure random source, with duplicate control and sorting.
Written by Suhaib Hassan. Our methodology.
Integers, floats and Gaussian draws use crypto.getRandomValues (a CSPRNG) for true browser-sourced randomness; the seeded mode uses a deterministic PRNG (mulberry32) so the same seed always reproduces the same sequence.
Nothing leaves your browser — no numbers are logged or sent anywhere, and a seeded run is fully reproducible for testing.
—
Sample distribution
Where each value falls in its range.
Step-by-step working
—
How each mode generates numbers
- Integer / Float: uses
crypto.getRandomValues, the same cryptographically secure source browsers use for security tokens — far higher quality thanMath.random(). - Gaussian: combines two uniform CSPRNG draws with the Box–Muller transform to produce normally-distributed values with your chosen mean and standard deviation.
- Seeded: uses the mulberry32 deterministic algorithm — the same seed always produces the same sequence, useful for reproducible tests and simulations (not for security).
By Suhaib Hassan · Reviewed 29 September 2026 · How CalculatePilot verifies formulas →
Sources
- Box, G. E. P., & Muller, M. E. (1958). A note on the generation of random normal deviates. Annals of Mathematical Statistics 29(2), 610–611.
- W3C (2017). Web Cryptography API —
Crypto.getRandomValues()specification.
Frequently asked questions
Is this suitable for cryptographic keys?
The Integer and Float modes draw from crypto.getRandomValues, the browser's cryptographically secure generator, so the raw randomness is suitable. For actual key material, use a dedicated cryptography library that handles encoding and key formats correctly — this tool is for general-purpose random numbers.
What does "no duplicates" mean?
It samples without replacement — like drawing lottery balls without putting them back — so every value in the output is distinct. It requires the range to contain at least as many values as you're requesting.
Why use a seeded generator instead of true randomness?
A seeded (deterministic) generator lets you reproduce the exact same "random" sequence again later — essential for debugging simulations, sharing reproducible examples, or writing tests with predictable output.
How does the Box–Muller transform create a normal distribution?
It takes two independent uniform random numbers and applies √(−2 ln u₁)·cos(2πu₂) (and a sine variant), which can be shown mathematically to produce exactly standard normal N(0,1) values — then scaled by σ and shifted by μ.
Why is Math.random() not used here?
Math.random() is not specified to be cryptographically secure and its algorithm varies by browser. crypto.getRandomValues() is a web standard specifically designed for unpredictable, high-quality randomness.
Related calculators
Continue with statistics.