Custom Numbers Generator
Generate custom random numbers with configurable range, count, uniqueness, sorting, step, distribution, and exclusions. Copy or download results instantly.
About
Producing statistically sound random number sets requires more than calling Math.random. This generator uses the crypto.getRandomValues API when available, providing cryptographically secure pseudorandom output suitable for simulations, sampling, and lottery-style draws. You configure the range [min, max], quantity n, step constraint s, uniqueness, sorting order, and distribution model. Misconfigured parameters - requesting 500 unique integers from a pool of 100 - produce silent data gaps in naive tools. This tool validates constraints before generation and reports conflicts explicitly.
Three distribution modes are supported: uniform, Gaussian (normal via the Box-Muller transform with configurable ฮผ and ฯ), and weighted custom ranges. The step parameter restricts output to the arithmetic sequence min + k โ s, useful for generating multiples or fixed-resolution grids. Exclusion lists remove unwanted values from the output pool before sampling. Note: Gaussian mode produces floating-point results clamped to [min, max]; extreme ฯ values relative to range width will cluster output near the mean and increase rejection rate.
Formulas
Uniform integer generation maps a secure random byte to the target range using rejection sampling to eliminate modulo bias:
where U โ [0, 1) is a uniform random float and poolSize = floor((max โ min) รท step) + 1.
For Gaussian distribution, the Box-Muller transform converts two uniform samples into a standard normal variate:
The output is then scaled and shifted: X = ฮผ + ฯ โ Z, then clamped to [min, max].
For unique generation, the Fisher-Yates shuffle is applied to the full pool array and the first n elements are selected, guaranteeing O(n) time without retry loops when n โค poolSize. When the pool exceeds 1,000,000, a Set-based rejection method is used instead to avoid memory exhaustion.
Where min = lower bound, max = upper bound, step = spacing, n = count, ฮผ = mean, ฯ = standard deviation, U1 and U2 = independent uniform random samples.
Reference Data
| Parameter | Default | Range | Description |
|---|---|---|---|
| Minimum | 1 | โ1,000,000 to 1,000,000 | Lower bound (inclusive) |
| Maximum | 100 | โ1,000,000 to 1,000,000 | Upper bound (inclusive) |
| Count | 10 | 1 to 100,000 | Numbers to generate |
| Step | 1 | 0.001 to 1,000,000 | Spacing between valid values |
| Decimals | 0 | 0 to 10 | Decimal places in output |
| Unique | No | Yes / No | Prevent duplicate values |
| Sort | None | None / Asc / Desc | Output ordering |
| Distribution | Uniform | Uniform / Gaussian / Weighted | Statistical distribution model |
| Mean (ฮผ) | 50 | Any within range | Center of Gaussian bell curve |
| Std Dev (ฯ) | 15 | > 0 | Spread of Gaussian distribution |
| Exclusions | Empty | Comma-separated | Values to exclude from output |
| Delimiter | Newline | Newline / Comma / Space / Tab / Custom | Separator between output numbers |
| Prefix | Empty | Any string | Prepended to each number |
| Suffix | Empty | Any string | Appended to each number |
| Max Pool (Unique) | - | Computed | (max โ min) รท step + 1 โ exclusions |