Uniform Distribution Calculator

Compute probabilities, expected value, variance, and standard deviation for continuous and discrete uniform distributions. Visualize the probability density function (PDF), cumulative distribution function (CDF), or probability mass function (PMF) on an interactive canvas.

Choose the distribution type to match your data
Compute cumulative probability P(X ≤ x) for the given x.
Compute P(x₁ ≤ X ≤ x₂) for the specified range.
Examples:
Continuous [0,10]
Continuous [2,8]
Discrete {1,2,3,4,5,6}
Discrete {0,1,2,...,10}
Continuous [−5,5]
Privacy first: All calculations are performed locally in your browser. No data is sent to any server. The graphs are rendered on your device.

What is the Uniform Distribution?

The uniform distribution is one of the simplest and most fundamental probability distributions in statistics. It models situations where every outcome in a given interval or finite set is equally likely. The uniform distribution comes in two flavors: continuous and discrete.

For a continuous uniform distribution on [a, b]:

f(x) = 1 / (b − a)   for a ≤ x ≤ b,   and 0 otherwise.

F(x) = (x − a) / (b − a)   for a ≤ x ≤ b.


For a discrete uniform distribution on {a, a+1, …, b}:

P(X = k) = 1 / (b − a + 1)   for k = a, a+1, …, b.

F(k) = (k − a + 1) / (b − a + 1)   for k = a, a+1, …, b.

Why Use an Interactive Uniform Distribution Calculator?

  • Visual Learning: See the PDF/PMF and CDF curves change in real time as you adjust parameters. Understand how the distribution shape reflects the "equal probability" property.
  • Educational Aid: Verify homework, prepare for exams, or explore probability concepts interactively. Ideal for AP Statistics, college-level probability, and data science courses.
  • Data Analysis: Quickly compute probabilities and statistical measures for uniform distributions encountered in Monte Carlo simulations, random number generation, and quality control.
  • Research & Development: Use in simulation studies, sensitivity analysis, and when modeling prior distributions in Bayesian statistics.

Continuous vs. Discrete Uniform Distribution

The continuous uniform distribution is defined over a continuous interval [a, b]. Any real number within the interval is equally likely. The probability density function (PDF) is a constant 1/(b−a), and the cumulative distribution function (CDF) increases linearly from 0 to 1. This distribution is commonly used in random number generation — the standard rand() function in most programming languages produces a continuous uniform distribution on [0, 1].

The discrete uniform distribution is defined over a finite set of integers {a, a+1, …, b}. Each integer in the set has equal probability 1/(b−a+1). The probability mass function (PMF) is constant, and the CDF is a step function that increases by 1/(b−a+1) at each integer. This distribution models fair dice rolls, random sampling from a finite population, and many other discrete equally-likely scenarios.

Both distributions share the same expected value: (a+b)/2. The variance differs: for continuous it is (b−a)²/12, while for discrete it is ((b−a+1)² − 1)/12. This subtle difference is important to remember when working with real-world data.

Key Properties and Formulas

Property Continuous Uniform [a, b] Discrete Uniform {a, a+1, …, b}
Support a ≤ x ≤ b k = a, a+1, …, b
PDF / PMF f(x) = 1/(b−a) P(X=k) = 1/(b−a+1)
CDF F(x) = (x−a)/(b−a) F(k) = (k−a+1)/(b−a+1)
Expected Value (μ) (a+b)/2 (a+b)/2
Variance (σ²) (b−a)²/12 ((b−a+1)² − 1)/12
Standard Deviation (σ) (b−a)/√12 √(((b−a+1)² − 1)/12)
Median (a+b)/2 (a+b)/2
Skewness 0 0
Excess Kurtosis −6/5 −6/5 · (n²+1)/(n²−1), n = b−a+1
Case Study: Fair Dice and Uniformity

A standard six‑sided die is a classic example of a discrete uniform distribution over {1, 2, 3, 4, 5, 6}. Each face has probability 1/6. The expected value is 3.5, variance is 35/12 ≈ 2.9167, and standard deviation ≈ 1.7078. Our calculator can compute these statistics instantly. In quality control, manufacturers use uniform distribution assumptions to test whether dice are "fair" — if the observed frequencies deviate significantly from the uniform PMF, the die may be biased.

In simulation, continuous uniform distributions are used to generate random numbers that are then transformed to other distributions (e.g., inverse transform method). The calculator helps visualize how the uniform distribution serves as the foundation for more complex probability models.

The Role of the Uniform Distribution in Statistics

The uniform distribution is foundational in statistics for several reasons. First, it is the maximum entropy distribution for a given interval — meaning it represents the state of "maximum ignorance" or "no prior information" about a parameter. This makes it a common choice as a prior distribution in Bayesian statistics (the "uniform prior"). Second, the probability integral transform states that for any continuous random variable X with CDF F, the random variable U = F(X) follows a continuous uniform distribution on [0, 1]. This property is the basis for many simulation and sampling techniques, including the inverse transform method and copula modeling.

In hypothesis testing, the p‑value is uniformly distributed under the null hypothesis, making the uniform distribution central to the interpretation of statistical significance. Understanding the uniform distribution is thus essential for anyone working with data, from students to seasoned researchers.

Step‑by‑Step: How to Use This Calculator

  1. Choose the distribution type: Continuous or Discrete using the toggle buttons.
  2. Enter the minimum (a) and maximum (b) parameters. For discrete distributions, a and b must be integers.
  3. For continuous: enter an x value to compute P(X ≤ x), and optionally enter lower/upper bounds for a range probability.
  4. For discrete: enter a k value to compute P(X = k) and P(X ≤ k).
  5. Click Calculate & Draw to see the results and the interactive graph.
  6. Use the example presets to quickly explore different scenarios.

Real‑World Applications

  • Random Number Generation: The continuous uniform distribution is the basis for most pseudo‑random number generators (PRNGs). Understanding its properties is essential for simulation and cryptography.
  • Quality Control: Uniform distributions model tolerances in manufacturing — e.g., the diameter of a bolt may be uniformly distributed within specified limits.
  • Monte Carlo Simulation: Uniform random variables are used to sample from other distributions via transformation methods.
  • Queueing Theory: Inter‑arrival times in some models are assumed to be uniformly distributed over a short interval.
  • Sports Analytics: Modeling the distribution of shot angles or player positions on a field can use uniform assumptions as a baseline.
  • Cryptography: One‑time pads and other cryptographic protocols rely on uniform random numbers to ensure security.

Common Misconceptions

  • "Uniform distribution means all values are equally likely." This is true only for discrete uniform distributions. For continuous uniform, every interval of equal length has equal probability, but individual points have probability zero.
  • "The uniform distribution is always flat." The PDF of a continuous uniform is flat (constant), but the CDF is a straight line. The discrete PMF is constant, but the CDF is a step function.
  • "Uniform distributions are not useful in practice." On the contrary, they are among the most widely used distributions in statistics, simulation, and data science.
  • "The mean and median are different for uniform distributions." For any symmetric distribution, including uniform, the mean equals the median. For uniform, both are (a+b)/2.

Advanced: The Uniform Distribution and the Central Limit Theorem

While the uniform distribution itself is simple, it plays a starring role in the Central Limit Theorem (CLT). The CLT states that the sum of independent, identically distributed random variables (with finite variance) tends toward a normal distribution. When the variables are uniformly distributed, the convergence is particularly easy to observe. In fact, the sum of two independent uniform(0,1) variables has a triangular distribution, and the sum of three has a distribution that is already quite close to normal. This makes the uniform distribution an excellent teaching tool for demonstrating the CLT in action.

Frequently Asked Questions

The continuous uniform distribution is defined over a continuous interval [a, b] where any real number is equally likely. The discrete uniform distribution is defined over a finite set of integers {a, a+1, …, b} where each integer is equally likely. The formulas for variance and the interpretation of probability differ between the two.

The PDF f(x) = 1/(b−a) is a constant over the interval [a, b]. It represents the "density" of probability — the probability that X falls in a small interval [x, x+dx] is approximately f(x)·dx. The total area under the PDF curve is always 1.

No. For discrete uniform distributions, a and b must be integers. The calculator will warn you if you enter non‑integer values. For continuous distributions, a and b can be any real numbers (with a < b).

For both continuous and discrete uniform distributions on [a, b] or {a, …, b}, the expected value is (a+b)/2. This is the midpoint of the interval.

The calculations use double‑precision floating point arithmetic, providing accuracy to about 15 decimal digits. For typical educational and professional use, this is more than sufficient.

Visit authoritative resources like Wolfram MathWorld, Khan Academy, or the classic textbook "Statistical Inference" by Casella and Berger. For interactive exploration, our other distribution calculators (Normal, Binomial, Exponential) are also available.
References: MathWorld Uniform Distribution; Casella, G. & Berger, R.L. "Statistical Inference" (2002); Wikipedia: Continuous Uniform Distribution; Wikipedia: Discrete Uniform Distribution.
Last reviewed: June 2026 by the GetZenQuery statistics team.