Skip to main content

Uniform Distribution Calculator

Ready to calculate
Continuous Uniform U(a,b).
PDF · CDF · Quantile.
Interval Probability.
100% Free.
No Data Stored.

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 uniform distribution (also called the rectangular distribution) is the simplest continuous probability distribution, where every value in a specified interval [a, b] is equally likely to occur. The uniform distribution calculator computes the probability density function (PDF), cumulative distribution function (CDF), mean, variance, standard deviation, and probability of values falling within any sub-interval of [a, b].

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

PDF (constant height):
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

Real-World Example

Calculation In Practice

Example: Bus Arrival
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

1

Random Number Generation

The foundation of all pseudorandom number generators producing U(0,1) values for simulation.
2

Simulation and Modeling

Model uncertainty in parameters where only bounds are known and all values are equally plausible.
3

Scheduling and Queuing

Model service times or inter-arrival times that are approximately uniformly distributed.
4

Bayesian Flat Priors

Use uniform distribution as a non-informative prior when parameter value is only constrained to a range.
5

Statistical Testing

Under the null hypothesis, p-values follow a uniform distribution, enabling multiple testing correction methods.

Technical Reference

Uniform Distribution Properties:
  • Mean = Median = Mode = (a+b)/2

  • Skewness = 0 (symmetric)

  • Kurtosis = 9/5 (platykurtic)

  • MGF: (e^(tb) − e^(ta)) / (t(b−a))

  • Entropy: ln(b−a) nats
  • Discrete Uniform Distribution:
    For n equally likely outcomes {1,2,...,n}:

  • P(X=k) = 1/n

  • E = (n+1)/2

  • Var = (n²−1)/12
  • 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 is the starting point of probability and statistics. Its simplicity — constant probability density over a bounded interval — makes it the benchmark against which other distributions are compared and the foundation of random number generation and simulation.

    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.

    Frequently Asked Questions

    What is the uniform distribution?
    The uniform distribution U(a,b) assigns equal probability to all values in the interval [a,b]. Its PDF is constant at 1/(b−a) over the interval and 0 outside it.
    What is the mean of the uniform distribution?
    E = (a+b)/2, the midpoint of the interval. The uniform distribution is symmetric, so mean = median = mode = midpoint.
    What is the variance of the uniform distribution?
    Var = (b−a)²/12. A wider interval has larger variance. The factor 1/12 is why dice variance uses (N²−1)/12 for a discrete uniform die.
    How do I find the probability of an interval?
    P(c ≤ X ≤ d) = (d−c)/(b−a) for any c, d within [a,b]. The probability equals the ratio of interval lengths.
    What is the CDF of the uniform distribution?
    F(x) = (x−a)/(b−a) for x in [a,b]. It is linear, reflecting the constant probability density. The CDF increases linearly from 0 at x=a to 1 at x=b.
    Why is the uniform distribution important for random number generation?
    All PRNGs produce U(0,1) values. Any distribution can be generated by applying the inverse CDF (quantile function) to U(0,1) values — called inverse transform sampling.
    What does the uniform distribution look like?
    Its PDF is a horizontal rectangle (flat line) of height 1/(b−a) from a to b. Its CDF is a straight line from (a,0) to (b,1). Both are the simplest possible shapes for a PDF and CDF.
    What is a non-informative prior?
    A uniform prior U(a,b) represents maximum uncertainty — all values in [a,b] are equally plausible before seeing any data. It is the most common non-informative prior in Bayesian analysis.
    Why are p-values uniform under the null hypothesis?
    When H₀ is true, the p-value follows U(0,1). This means in repeated experiments under H₀, any p-value between 0 and 1 is equally likely, forming the basis for false discovery rate control.
    How does the discrete uniform differ from the continuous?
    Discrete uniform U{1,...,n} has probability 1/n for each integer. Continuous uniform U(a,b) assigns zero probability to any individual point but positive probability to intervals.

    Author Spotlight

    The ToolsACE Team - ToolsACE.io Team

    The ToolsACE Team

    Our specialized research and development team at ToolsACE brings together decades of collective experience in financial engineering, data analytics, and high-performance software development.

    Statistical AnalysisSoftware Engineering Team