Uniform Distribution Calculator
How it Works
01Set Interval [a, b]
Enter the lower bound (a) and upper bound (b) of the uniform interval.
02Enter a Value x
Compute the CDF and PDF at any specific point within the interval.
03Get PDF, CDF, Stats
PDF = 1/(b−a); CDF = (x−a)/(b−a); Mean = (a+b)/2; Var = (b−a)²/12.
04Interval Probability
Compute P(c ≤ X ≤ d) = (d−c)/(b−a) for any sub-interval.
Introduction
The continuous uniform distribution is the foundation of random number generation: most computer random number generators produce uniformly distributed values between 0 and 1, which can then be transformed to any other distribution. Understanding the uniform distribution is therefore essential to understanding statistical simulation, Monte Carlo methods, and random sampling.
A key property is that P(X ≤ x) = (x − a) / (b − a) for any x in [a, b]. This linear CDF means probability accumulates uniformly — equal-length subintervals have equal probability. The PDF f(x) = 1/(b−a) is constant across the interval.
The uniform distribution serves as the maximum entropy distribution for bounded, continuous random variables. When you know only that a value lies within [a, b] and have no other information, the uniform distribution represents the least informative (maximum entropy) prior — a principle central to Bayesian statistics.
Applications include: random number generation, simulation, bootstrap sampling, waiting time modeling (when arrival times are uniformly distributed), scheduling problems, and as a reference distribution for testing statistical methods.
The formula
f(x) = 1/(b−a) for a ≤ x ≤ b
f(x) = 0 otherwise
CDF:
F(x) = (x−a)/(b−a) for a ≤ x ≤ b
F(x) = 0 for x < a
F(x) = 1 for x > b
Mean:
E = (a + b) / 2
Variance:
Var = (b−a)² / 12
Standard Deviation:
SD = (b−a) / √12 = (b−a) / (2√3)
Median = Mean = (a+b)/2
Calculation In Practice
A bus arrives uniformly between 0 and 30 minutes after you arrive at the stop.
a = 0, b = 30 minutes
PDF = 1/30 ≈ 0.0333 per minute
Mean = (0+30)/2 = 15 minutes
Variance = (30)²/12 = 75 min²
SD = √75 = 8.66 minutes
P(wait < 10 min) = (10−0)/(30−0) = 1/3 ≈ 33.3%
P(5 ≤ wait ≤ 20) = (20−5)/30 = 0.5 = 50%
Typical Use Cases
Random Number Generation
Simulation and Modeling
Scheduling and Queuing
Bayesian Flat Priors
Statistical Testing
Technical Reference
Discrete Uniform Distribution:
For n equally likely outcomes {1,2,...,n}:
Inverse CDF (quantile function):
F⁻¹(p) = a + p×(b−a)
Generating any distribution from U(0,1):
Inverse transform sampling: X = F⁻¹(U) where U ~ Uniform(0,1)
Key Takeaways
The uniform distribution has the highest entropy of any continuous distribution with known bounds, making it the "most random" distribution when the only constraint is that values lie within [a, b]. This maximum entropy property makes it the natural choice as a non-informative prior in Bayesian analysis.
Remember: p-values, under the null hypothesis, are exactly uniformly distributed on [0, 1]. This is why QQ plots of p-values should appear uniform (straight line against the 45° line), and why multiple testing corrections like Bonferroni and Benjamini-Hochberg are derived from uniform distribution theory.