Generate integers or decimals with full control over range, duplicates, sorting, and reproducibility.Instantly view statistical summaries and a dynamic histogram.
A random number generator (RNG) is a computational or physical device designed to produce a sequence of numbers that lack any predictable pattern. In practice, most software RNGs are pseudorandom number generators (PRNGs)—deterministic algorithms that produce sequences that appear random for practical purposes. True randomness, by contrast, is derived from physical phenomena such as atmospheric noise, radioactive decay, or quantum effects.
A PRNG starts from a seed and applies a deterministic transition function:
xn+1 = (a · xn + c) mod m
(Linear Congruential Generator — one of the oldest PRNG families)
This tool uses a high-quality PRNG (Mulberry32) when a seed is provided, and falls back to Math.random() (which itself is typically backed by a PRNG like xorshift128+ in modern
browsers) when no seed is given. You can optionally supply a seed to make results reproducible—ideal
for debugging, teaching, or scientific workflows.
The tool operates in three phases. First, it validates your inputs (range, count, decimal places) and applies the requested constraints. If a seed is provided, a Mulberry32 pseudorandom generator is instantiated; otherwise, the browser's built-in RNG is used. Mulberry32 is a 32‑bit PRNG with excellent statistical properties, a period of 232, and a simple implementation that makes it ideal for client‑side use.
Next, the generator produces the requested number of values. For integers, values are uniformly distributed across the inclusive range [min, max]. For decimals, values are uniformly distributed across [min, max) with the specified precision. The "Allow Duplicates" setting controls whether the same value can appear more than once (when disabled, the count must not exceed the range size).
Finally, the results are sorted (if requested), and statistical summaries are computed: count, minimum, maximum, sum, arithmetic mean, median, standard deviation (sample), and range. A histogram is automatically generated using the Freedman‑Diaconis rule for bin width selection, providing a visual representation of the distribution.
A quantitative analyst needs to estimate the Value at Risk (VaR) of a portfolio. They run 10,000 simulations of asset returns using a random number generator. The quality of the RNG directly affects the accuracy of the VaR estimate. Using a seeded PRNG allows the analyst to reproduce the simulation for audit or debugging. Our tool, while not designed for high‑frequency trading, demonstrates the core principles—uniform sampling, statistical aggregation, and reproducibility—that underpin such simulations.
Game developers use seeded RNGs to generate consistent worlds, loot drops, and enemy behaviors. A seed ensures that every player experiences the same "random" events in a given playthrough. Our generator's seed feature lets you test this concept: generate a set of numbers with a seed, then regenerate the same set by re‑entering the seed. This deterministic reproducibility is the foundation of procedural generation in games like Minecraft and No Man's Sky.
| Measure | Definition | Use Case |
|---|---|---|
| Mean | Arithmetic average of all values | Central tendency; expected value |
| Median | Middle value when sorted | Robust central tendency (less affected by outliers) |
| Standard Deviation | Measure of dispersion around the mean | Quantifies spread; volatility in finance |
| Range | Max − Min | Quick measure of spread; sensitive to extremes |
| Mode | Most frequent value (if any) | Categorical data; peak of distribution |
Randomization is a cornerstone of modern science. In experimental design, random assignment reduces bias and ensures that treatment groups are comparable. In computational statistics, random sampling enables estimation of population parameters from samples. The quality of randomization directly affects the validity of statistical inferences.
This tool can be used to illustrate the Law of Large Numbers: as the sample size increases, the sample mean converges to the expected value. Generate 10, 100, and 1,000 numbers from the same range and observe how the mean stabilizes. The histogram also shows how the empirical distribution approaches the theoretical uniform distribution as the sample size grows.
crypto.getRandomValues() in browsers or /dev/urandom on Unix systems.