Random Number Generator

Generate unbiased random integers within any custom bounds. Support for multi-draw sampling, Fisher-Yates duplicate exclusion, and live statistical metrics.

Generator Parameters

Quick Presets
Generated Numbers (5 Draws)
Range: [1 to 100]
1442688195

Sum

300

Mean

60.0

Min

14

Max

95

Range

81

Even/Odd

3/2

Uniform Distribution Properties

As your sample count grows, the observed sample mean naturally converges to the theoretical midpoint (50.5) by the Law of Large Numbers.

Discrete Uniform Probability & Random Sampling

Generating integer samples uniformly across a bounded discrete interval [a, b] assigns an equal probability P(X = k) = 1 ÷ (b - a + 1) to every integer k ∈ [a, b].

1. Discrete Uniform Transformation Formula
X=⌊ U × (Max − Min + 1) ⌋ + Min(where U ~ Uniform[0, 1))
2. Theoretical Expected Mean & Variance
μ=
Min + Max2
,σ²=
(Max − Min + 1)² − 112
Step-by-Step Sampling Breakdown (Range: 1 to 100, Count: 5)
Step 1: Compute Span & Theoretical Expectation
Range Span = 100 − 1 + 1 = 100 integers; Expected Mean μ = (1 + 100) / 2 = 50.5
Step 2: Draw Sample Vector
Generated Numbers: [14, 42, 68, 81, 95] (Sample Sum = 300)
Step 3: Calculate Sample Mean & Spread
Sample Mean=300 / 5=60.00 (Spread: 81)

Common Probability & Gaming Ranges

ApplicationRange [Min, Max]Possible OutcomesExpected Mean
D6 Standard Die1 – 663.5
D20 Tabletop RPG Die1 – 202010.5
Percentile (D100)1 – 10010050.5
Classic Lottery (6/49)1 – 494925.0

Frequently Asked Questions

How does the random number generator work?
The generator uses a linear transformation of the pseudo-random uniform distribution U(0,1) scaled to your discrete bounds: Math.floor(Math.random() * (max - min + 1)) + min. For sampling without replacement, it executes a Fisher-Yates shuffle.
Can I generate negative integers or large numbers?
Yes. You can specify negative minimum bounds (e.g., -50 to +50) or values up to JavaScript's Number.MAX_SAFE_INTEGER (9,007,199,254,740,991).
What is the difference between sampling with and without replacement?
Allowing duplicates draws each number independently (with replacement). Disabling duplicates guarantees every drawn integer in the output list is distinct (without replacement).
Is this suitable for cryptography or high-stakes draws?
For general statistical sampling, board games, classroom raffles, and gaming, this tool is ideal. For cryptographically secure secrets or key material, consider our Password Generator which utilizes hardware-backed CSPRNG.

Related Tools