Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Continuous Uniform Distribution






Continuous Uniform Distribution: Equal Likelihood Over an Interval


The probabilistic experiment behind the continuous uniform distribution consists of selecting a value at random from a fixed interval, where no value within the interval is preferred over another. Any subinterval of equal length has the same probability of being selected. The randomness lies purely in position within the interval, not in frequency or accumulation of events.

Key Terms

Equally Likely Events— the continuous analog: equal density at every point
Probability Density Function— f(x)=1/(b−a)f(x) = 1/(b-a) defining the distribution
Cumulative Distribution Function— F(x)=(x−a)/(b−a)F(x) = (x-a)/(b-a)
Expected Value— E[X]=(a+b)/2E[X] = (a+b)/2
Variance— Var⁡(X)=(b−a)2/12\operatorname{Var}(X) = (b-a)^2/12

See All Probability Definitions →


The Probabilistic Experiment Behind continuous uniform distribution

A fair die gives each face the same chance, 1/6: no outcome is favoured over another.
The same kind of fairness can be asked of a value that may land anywhere in an interval — a bus that arrives at some random moment in the next 3030 minutes, with no moment more likely than another.
The die's rule cannot carry over directly: an interval holds infinitely many moments, so no single moment can get a positive share.
questionfair diebus at a random time in the next 30 minutes
chance of one exact outcome1/6 for each face0 for each exact moment
chance of a range of outcomesnumber of faces ÷ 6length of the window ÷ 30
example3 or 4: 2/6 = 1/3between minute 10 and 15: 5/30 = 1/6
Equal chances for single outcomes give way to equal chances for windows of equal length.
Fairness on an interval means probability proportional to length.
This type of experiment arises when the only information available is that a value lies somewhere between two limits, and there is no mechanism that biases one sub-interval over another. The uncertainty is purely geometric: probability corresponds to relative length, not to isolated points. Because the outcomes form a continuum, individual values have zero probability; only ranges matter.
The defining feature of this experiment is complete symmetry across the interval.
RULE
If one interval is twice as long as another, it is twice as likely to contain the outcome.
Nothing else distinguishes outcomes.
The definition
The continuous uniform distribution on an interval [a,b][a, b] gives every sub-interval a probability equal to its length divided by b−ab - a; no position inside the interval is preferred.
The probabilistic experiment behind the continuous uniform distribution begins with the assumption that an outcome can occur anywhere within a fixed interval, and that no location inside that interval is preferred over another. The key idea is not randomness over trials, but randomness over position or value. Once the bounds of the interval are set, the experiment treats every point between them as equally plausible.
So for a bus due at a uniform time within 3030 minutes, any 55-minute window has probability 530=16\frac{5}{30} = \frac{1}{6}.
It is the continuous counterpart of the discrete uniform: symmetry over an interval instead of a list.
Like the discrete uniform distribution, the continuous uniform distribution is built on the idea of complete symmetry, no outcome is favored over another. The difference lies only in how probability is assigned: discrete uniform spreads probability across a finite set of distinct values, while continuous uniform spreads it evenly across an entire interval, with probability determined by length rather than individual points.
Bus arrival uniform on [0, 30] minutes: the 5-minute window [5, 10] has probability 1/6, the 10-minute window [15, 25] has 1/3xy5101520253035f(x) = 1/30[5, 10]: 5/30 = 1/6[15, 25]: 10/30 = 1/3Twice the length, twice the probability: P = length / 30
Probability as length

A bus arrives at a uniformly random moment in the half hour [0, 30] minutes, so the density is the flat line at 1/30. The probability of a window is the area above it: the 5-minute window from 5 to 10 gets 5 × 1/30 = 1/6 (blue), the 10-minute window from 15 to 25 gets 10 × 1/30 = 1/3 (amber). Where the window sits does not matter; only its length does.

Any 5-minute window, early or late, has the same probability 1/6.

Example
Choose a real number at random between 0 and 10, with no additional information. The chance that the number lies between 2 and 4 depends only on the interval length (2 units), not on where it sits inside the range.
A single exact value always has probability 0 — only ranges carry probability.
The bus arriving at exactly minute 77 is possible, yet its probability is 00; the arrival falling between minutes 77 and 88 has probability 130\frac{1}{30}. The interval's endpoints are discussed in parameters, and the flat density that carries this rule in probability density function.
The rest of the page covers notation, the parameters, the support, the density and the cumulative distribution function, and the properties of the distribution.

Continuous Uniform Notation

Notation

Continuous Uniform Notation

The flat distribution has the plainest marks in the family and one genuine hazard: U(a,b)U(a, b) names this family and the discrete uniform equally well. What follows fixes the declaration, the density height that is a width's reciprocal, and the endpoints that turn out not to matter. All catalogued among the probability symbols.
The declaration tilde and capital/lowercase split come from random variable notation and distribution notation; ff for density from the probability function; interval brackets from interval notation; E[X]E[X] and Var⁡(X)\operatorname{Var}(X) from expected value and variance notation.
X∼U(a,b)X \sim U(a, b), U(0,1)U(0,1)
uniform on the interval from a to b — and the standard unit case
UU, Unif⁡\operatorname{Unif}, spelled-out Uniform⁡\operatorname{Uniform}; the two slots are the interval's endpoints, not a centre and a spread — unlike every other continuous family on the site, the parameters name where rather than how much. U(0,1)U(0,1) is the standard instance and the source of essentially all computer-generated randomness.
CasesThe same U(a,b)U(a,b) serves the discrete uniform, so texts that use both disambiguate in prose or switch to DU⁡\operatorname{DU} for the discrete one; a density in the neighborhood settles it in this family's favor.
Do not confuseA mean-and-spread pair. Reading U(2,8)U(2, 8) as "centre 2, width 8" — the normal's habit — inverts the model completely; here the numbers are the interval's ends, and the centre a+b2\tfrac{a+b}{2} has to be computed.
f(x)=1b−af(x) = \dfrac{1}{b - a}
constant density: one over the interval's width
A flat density whose height is fixed by the requirement that area equal one — so the height is the reciprocal of the width, with no +1+1 anywhere: the discrete uniform's 1/(b−a+1)1/(b-a+1) counts values, this measures an interval.
CasesNarrow intervals push the height above one — U(0,0.5)U(0, 0.5) has density 22 everywhere — the family's cleanest demonstration that a density is not a probability; probability only appears after multiplying by a width.
Do not confuseA probability of 1b−a\tfrac{1}{b-a} per point. Every individual point carries probability zero here; the constant is a rate per unit length, and it becomes a probability only when an interval is specified.
[a,b][a, b] vs (a,b)(a, b)
closed or open — the same distribution either way
Sources write the support as [a,b][a,b], (a,b)(a,b) or any half-open mix, and all describe the same distribution: the endpoints are two points in an uncountable interval, so including or excluding them changes no probability at all. The bracket-versus-parenthesis distinction that decides membership elsewhere is inert here.
CasesThe contrast is exactly what makes it notable: on the discrete uniform dropping an endpoint deletes an outcome and rescales every probability, while here it deletes nothing measurable — the same edit, two entirely different consequences.
Do not confuseA meaningful distinction, imported from set theory. Arguing over whether bb "belongs" wastes the effort the notation is trying to save; what does matter is that a<ba < b, since a=ba = b collapses the width and the density's denominator with it.
DownloadPNG2×PDF
Notation · Cheat sheet
Distribution Notation at a Glance
The marks from the notation cards across the distribution pages: how each is read and what it means. Every group links to the full card on its page.
Distributions
(Ω,F,P)(\Omega, \mathcal{F}, \mathbb{P})
a probability space
Outcomes, events, and the probability measure.
PX(A)\mathbb{P}_X(A)
the distribution of X
Equals P(X∈A)\mathbb{P}(X \in A).
X=dYX \overset{d}{=} Y
equal in distribution
Same law, not necessarily the same values.
Binomial
X∼Bin⁡(n,p)X \sim \operatorname{Bin}(n, p)
binomial, n trials, p
The number of successes in nn independent trials.
q=1−pq = 1 - p
q, the failure probability
An abbreviation, not a new parameter.
Geometric
Geom⁡(p)\operatorname{Geom}(p)
geometric with p
Two conventions: count trials, or count failures.
qk−1pq^{k-1}p vs qkpq^k p
the two pmfs
The exponent shows which convention is in use.
Negative binomial
NB⁡(r,p)\operatorname{NB}(r, p)
negative binomial
Trials until the rr-th success.
k=r,r+1,…k = r, r{+}1, \ldots
the support starts at r
Fewer trials cannot hold rr successes.
Hypergeometric
Hyp⁡(N,K,n)\operatorname{Hyp}(N, K, n)
hypergeometric
Population NN with KK successes; nn draws without replacement.
(Kk)(N−Kn−k)(Nn)\frac{\binom{K}{k}\binom{N-K}{n-k}}{\binom{N}{n}}
the pmf
Successes chosen, failures chosen, over all samples.
Poisson
Pois⁡(λ)\operatorname{Pois}(\lambda)
Poisson with rate lambda
Counts of events in a window.
λ\lambda
lambda
The expected count per window; it depends on the window size.
Discrete uniform
DU⁡(a,b)\operatorname{DU}(a, b)
discrete uniform
Each integer from aa to bb equally likely.
1b−a+1\frac{1}{b - a + 1}
one over the count
The +1+1 counts both endpoints.
Continuous uniformThis page
X∼U(a,b)X \sim U(a, b)
uniform from a to b
The slots are the endpoints, not a centre and a spread.
1b−a\frac{1}{b - a}
one over the width
A flat density; no +1+1 here.
Exponential
Exp⁡(λ)\operatorname{Exp}(\lambda)
exponential with rate lambda
Some books put the scale β=1λ\beta = \frac{1}{\lambda} in the slot.
P(X>x)=e−λxP(X > x) = e^{-\lambda x}
the survival tail
The chance of waiting longer than xx.
Normal
N(μ,σ2)N(\mu, \sigma^2)
normal, mean mu
Second slot: usually the variance; some texts use σ\sigma.
Z∼N(0,1)Z \sim N(0, 1)
capital Z, standard normal
A score z=x−μσz = \frac{x - \mu}{\sigma} counts standard deviations.
φ(z),  Φ(z)\varphi(z), \; \Phi(z)
phi; capital Phi
The standard normal density and its CDF.
Same marks, different job
N(μ,σ2)N(\mu, \sigma^2)Check whether the second slot is the variance or the standard deviation.
Exp⁡(λ)\operatorname{Exp}(\lambda)Rate or scale: the two readings give means 1λ\frac{1}{\lambda} and λ\lambda.
U(a,b)U(a, b) vs DU⁡(a,b)\operatorname{DU}(a, b)Width b−ab - a against a count of b−a+1b - a + 1 values.
Φ\Phi vs φ\varphiCapital is the CDF, lowercase the density.
Distribution Notation at a Glance·/probability/distributionsLearn Math Class

Parameters


a: lower bound of the interval, where a∈Ra \in \mathbb{R}

b: upper bound of the interval, where b∈Rb \in \mathbb{R} and b>ab > a

The continuous uniform distribution is fully characterized by these two parameters. a and b define the endpoints of the interval where the random variable can take values. The distribution assigns equal probability density to every point in this interval, making it the simplest continuous distribution.

Probability Density Function (PDF) and Support (Range)


Probability Density Function (PDF)


The probability density function (PDF) of a continuous uniform distribution is given by:

Continuous Uniform PDF
f(x)={1b−aif a≤x≤b0otherwisef(x) = \begin{cases} \frac{1}{b-a} & \text{if } a \leq x \leq b \\ 0 & \text{otherwise} \end{cases}
Learn more about this formula: Continuous Uniform PDF →


Intuition Behind the Formula


Constant Density: The uniform distribution has a flat, rectangular shape. The probability density is the same at every point within the interval [a, b].

Parameters:
• aa: The minimum value the random variable can take
• bb: The maximum value the random variable can take
• The width of the interval is b−ab - a

Support (Range of the Random Variable):
• The random variable XX can take any value in the closed interval: [a,b][a, b]
• Outside this interval, the probability density is zero
• The support is the finite interval [a, b]

Logic Behind the Formula:
• 1b−a\frac{1}{b-a}: The constant density ensures the total area under the curve equals 1
• The height of the rectangle is 1b−a\frac{1}{b-a} and the width is b−ab-a, so area = height × width = 1
• All subintervals of the same length have equal probability
• The total area under the curve equals 1:

Probability Density Function (PDF) and Support (Range)
∫ab1b−a dx=1b−a⋅(b−a)=1\int_{a}^{b} \frac{1}{b-a}\,dx = \frac{1}{b-a} \cdot (b-a) = 1

Practical Example
A bus arrives at a stop every 10 minutes. If you arrive at a random time, your wait time XX follows U(0,10)U(0, 10). The PDF is f(x)=110=0.1f(x) = \frac{1}{10} = 0.1 for 0≤x≤100 \leq x \leq 10. Any 2-minute interval within this range has the same probability: P(3≤X≤5)=P(7≤X≤9)=0.1×2=0.2P(3 \leq X \leq 5) = P(7 \leq X \leq 9) = 0.1 \times 2 = 0.2.

Continuous Uniform Distribution

Constant probability over an interval

Explanation

The continuous uniform distribution has constant probability density over the interval [a,b][a, b]. The probability density function is f(x)=1b−af(x) = \frac{1}{b-a} for a≤x≤ba \leq x \leq b, and 00 otherwise. The expected value is E[X]=a+b2E[X] = \frac{a+b}{2} and the variance is Var(X)=(b−a)212\text{Var}(X) = \frac{(b-a)^2}{12}. This distribution models situations where all values in an interval are equally likely, such as the position of a randomly thrown dart on a board, random arrival times within a time window, or measurement errors uniformly distributed within tolerances.

0.000.020.040.060.080.10-2-0.31.53.25.06.78.410.211.9xf(x)
Continuous uniform density, a = 0, b = 10

The density is a flat line at height 1 over b minus a across the interval and zero outside it, so every subinterval of the same length carries the same probability. The rectangle under the line has area exactly 1. Adjust the endpoints and watch the height compensate on the PDF visualizer.

Accumulating this flat density gives a ramp.
DownloadPNG2×PDF
Constant density
  • A flat, rectangular shape.
  • The density is the same at every point within the interval [a,b][a, b].
Parameters
  • aa: the minimum value the random variable can take.
  • bb: the maximum value the random variable can take.
  • The width of the interval is b−ab - a.
Support
  • XX can take any value in the closed interval [a,b][a, b].
  • Outside this interval, the probability density is zero.
Logic behind the formula
  • The height of the rectangle is 1b−a\frac{1}{b-a} and the width is b−ab-a, so the area is 11.
  • All subintervals of the same length have equal probability.
Uniform densityf(x)=1b−af(x) = \frac{1}{b-a} on [a,b][a, b]
Intuition Behind the FormulaLearn Math Class

Cumulative Distribution Function (CDF)

Cumulative Distribution Function (CDF)


The cumulative distribution function (CDF) gives the probability that XX is less than or equal to a specific value:

Continuous Uniform CDF
F(x)={0if x<ax−ab−aif a≤x≤b1if x>bF(x) = \begin{cases} 0 & \text{if } x < a \\ \frac{x-a}{b-a} & \text{if } a \leq x \leq b \\ 1 & \text{if } x > b \end{cases}
Learn more about this formula: Continuous Uniform CDF →


Key Properties:
• F(a)=0F(a) = 0 (no probability mass below the lower bound)
• F(b)=1F(b) = 1 (all probability mass is within [a, b])
• The CDF (Cumulative Distribution Function) increases linearly from 0 to 1 within the interval [a, b]
• For any xx in [a, b], F(x)F(x) represents the fraction of the interval covered from aa to xx

Pitfall: Extending the ramp past b
Using x−ab−a\frac{x-a}{b-a} beyond bb gives F(15)=1.5F(15) = 1.5 for U(0,10)U(0, 10), so P(8≤X≤15)=1.5−0.8=0.7P(8 \leq X \leq 15) = 1.5 - 0.8 = 0.7. Above bb the CDF stays at 11: P(8≤X≤15)=1−0.8=0.2P(8 \leq X \leq 15) = 1 - 0.8 = 0.2.

Practical Use: The CDF (Cumulative Distribution Function) for the uniform distribution is particularly simple.

Example
To find P(X≤x)P(X \leq x) when X∼U(0,10)X \sim U(0, 10) and x=3x = 3: F(3)=3−010−0=0.3F(3) = \frac{3-0}{10-0} = 0.3, meaning 30% of values fall below 3.

For any probability calculation: P(c≤X≤d)=F(d)−F(c)=d−ab−a−c−ab−a=d−cb−aP(c \leq X \leq d) = F(d) - F(c) = \frac{d-a}{b-a} - \frac{c-a}{b-a} = \frac{d-c}{b-a}.

Continuous Uniform Distribution CDF

Visualizing probability accumulation for continuous uniform distribution

Continuous Uniform - CDF

Linear increase from 0 to 1 over [a, b]

CDF Explanation

The cumulative distribution function (CDF) of the continuous uniform distribution is F(x)=x−ab−aF(x) = \frac{x-a}{b-a} for a≤x≤ba \leq x \leq b, F(x)=0F(x) = 0 for x<ax < a, and F(x)=1F(x) = 1 for x>bx > b. The CDF shows the probability that the random variable XX is less than or equal to xx, i.e., P(X≤x)P(X \leq x). For the uniform distribution, this probability increases linearly from 0 to 1 across the interval. This means that the probability of landing in the first half of the interval is exactly 0.5, and the probability increases uniformly as we move through the interval.
0.00.20.40.60.81.0-2-0.31.53.25.06.78.410.211.9xF(x) = P(X ≤ x)
Continuous uniform CDF, a = 0, b = 10

The CDF is a straight ramp from 0 at a to 1 at b: the accumulated area under a flat density grows linearly with x. Its constant slope is the density height, and the median is the midpoint of the interval. Read F at any point as the fraction of the interval to the left of it on the continuous CDF visualizer.

The mean sits at that same midpoint.

Expected Value (Mean)


For continuous distributions, the expected value emerges from integrating the product of each value with its density across the entire support. Applying the continuous expected value definition to the uniform distribution:

Expected Value (Continuous)
E[X]=∫−∞∞x⋅f(x) dxE[X] = \int_{-\infty}^{\infty} x \cdot f(x) \, dx
Learn more about this formula: Expected Value (Continuous) →


Formula


Continuous Uniform Mean
E[X]=a+b2E[X] = \frac{a + b}{2}
Learn more about this formula: Continuous Uniform Mean →


Where:
aa = minimum value of the interval
bb = maximum value of the interval

Derivation and Intuition


The continuous uniform distribution has PDF f(x)=1b−af(x) = \frac{1}{b-a} for a≤x≤ba \leq x \leq b, and 0 elsewhere. Computing the expected value:

Expected Value (Mean)
E[X]=∫abx⋅1b−a dx=1b−a∫abx dxE[X] = \int_{a}^{b} x \cdot \frac{1}{b-a} \, dx = \frac{1}{b-a} \int_{a}^{b} x \, dx

Expected Value (Mean)
E[X]=1b−a[x22]ab=1b−a⋅b2−a22E[X] = \frac{1}{b-a} \left[\frac{x^2}{2}\right]_{a}^{b} = \frac{1}{b-a} \cdot \frac{b^2 - a^2}{2}

Expected Value (Mean)
E[X]=1b−a⋅(b−a)(b+a)2=b+a2E[X] = \frac{1}{b-a} \cdot \frac{(b-a)(b+a)}{2} = \frac{b+a}{2}
The integral for the mean above as a chain, each line with its reason.
DownloadPNG2×PDF
ShowE[X]=a+b2E[X] = \frac{a+b}{2}
1
E[X]=∫abx⋅1b−a dxE[X] = \int_{a}^{b} x \cdot \frac{1}{b-a} \, dx
PDFThe PDF is f(x)=1b−af(x) = \frac{1}{b-a} for a≤x≤ba \leq x \leq b, and 0 elsewhere
2
=1b−a∫abx dx= \frac{1}{b-a} \int_{a}^{b} x \, dx
factorTake out the constant
3
=1b−a[x22]ab= \frac{1}{b-a} \left[\frac{x^2}{2}\right]_{a}^{b}
integrateAn antiderivative of xx
4
=1b−a⋅b2−a22= \frac{1}{b-a} \cdot \frac{b^2 - a^2}{2}
evaluateAt the limits bb and aa
5
=1b−a⋅(b−a)(b+a)2= \frac{1}{b-a} \cdot \frac{(b-a)(b+a)}{2}
key stepFactor the difference of squares
6
=b+a2= \frac{b+a}{2}
cancelThe factor b−ab - a cancels
E[X]=a+b2E[X] = \frac{a+b}{2}
Deriving the continuous uniform meanLearn Math Class
Factoring b2−a2b^2 - a^2 is the gold step: the factor b−ab - a cancels the height 1b−a\frac{1}{b-a} of the density.
The result E[X]=a+b2E[X] = \frac{a+b}{2} is the midpoint of the interval [a,b][a, b]. This makes perfect intuitive sense: when all values in an interval are equally likely, the average value is simply the center of that interval. The distribution is perfectly symmetric, and the expected value is the balance point.

This formula is identical to the discrete uniform distribution, showing that whether we count discrete equally-spaced values or measure continuous equally-dense values, the average lands at the center.

Example


Suppose a bus arrives randomly between 2:00 PM and 2:30 PM, modeled as uniform on the interval [0,30][0, 30] minutes after 2:00 PM:

Expected Value (Mean)
E[X]=0+302=15 minutesE[X] = \frac{0 + 30}{2} = 15 \text{ minutes}

Pitfall: Halving the width
Computing b−a2\frac{b-a}{2} for U(2,8)U(2, 8) gives 33, half the length of the interval rather than its centre. The mean is a+b2=2+82=5\frac{a+b}{2} = \frac{2+8}{2} = 5.

The expected arrival time is 2:15 PM, exactly halfway through the 30-minute window. If you repeatedly sample random arrival times, the long-run average will converge to 15 minutes after 2:00 PM.

To compute the expected value of a continuous uniform distribution for your own parameters, step by step, use the continuous uniform expected value calculator.

Variance and Standard Deviation


The variance of a continuous random variable quantifies the spread of values around the expected value (mean). For continuous distributions, it is calculated through integration:

Variance and Standard Deviation
Var(X)=E[(X−μ)2]=∫−∞∞(x−μ)2f(x) dx\mathrm{Var}(X) = \mathbb{E}[(X - \mu)^2] = \int_{-\infty}^{\infty} (x - \mu)^2 f(x) \, dx

Alternatively, using the computational formula:

Variance and Standard Deviation
Var(X)=E[X2]−μ2\mathrm{Var}(X) = \mathbb{E}[X^2] - \mu^2

For the continuous uniform distribution, this calculation produces a simple relationship with the interval length.

Formula


Continuous Uniform Variance
Var(X)=(b−a)212\mathrm{Var}(X) = \frac{(b-a)^2}{12}
Learn more about this formula: Continuous Uniform Variance →


Where:
aa = minimum value of the interval
bb = maximum value of the interval

Derivation and Intuition


Starting with the computational formula, we need to calculate E[X2]\mathbb{E}[X^2].

We know from the expected value section that μ=a+b2\mu = \frac{a+b}{2}.

The continuous uniform distribution has PDF f(x)=1b−af(x) = \frac{1}{b-a} for a≤x≤ba \leq x \leq b:

Variance and Standard Deviation
E[X2]=∫abx2⋅1b−a dx=1b−a∫abx2 dx\mathbb{E}[X^2] = \int_{a}^{b} x^2 \cdot \frac{1}{b-a} \, dx = \frac{1}{b-a} \int_{a}^{b} x^2 \, dx

Variance and Standard Deviation
E[X2]=1b−a[x33]ab=1b−a⋅b3−a33\mathbb{E}[X^2] = \frac{1}{b-a} \left[\frac{x^3}{3}\right]_{a}^{b} = \frac{1}{b-a} \cdot \frac{b^3 - a^3}{3}

Using the factorization b3−a3=(b−a)(b2+ab+a2)b^3 - a^3 = (b-a)(b^2 + ab + a^2):

Variance and Standard Deviation
E[X2]=b2+ab+a23\mathbb{E}[X^2] = \frac{b^2 + ab + a^2}{3}

Applying the computational formula:

Variance and Standard Deviation
Var(X)=b2+ab+a23−(a+b2)2\mathrm{Var}(X) = \frac{b^2 + ab + a^2}{3} - \left(\frac{a+b}{2}\right)^2

After algebraic simplification:

Continuous Uniform Variance
Var(X)=(b−a)212\mathrm{Var}(X) = \frac{(b-a)^2}{12}
Learn more about this formula: Continuous Uniform Variance →

The variance computation above as a chain, from the integral for E[X2]\mathbb{E}[X^2] to the computational formula.
DownloadPNG2×PDF
ShowVar(X)=(b−a)212\mathrm{Var}(X) = \frac{(b-a)^2}{12}
1
E[X2]=∫abx2⋅1b−a dx\mathbb{E}[X^2] = \int_{a}^{b} x^2 \cdot \frac{1}{b-a} \, dx
PDFThe PDF is f(x)=1b−af(x) = \frac{1}{b-a} for a≤x≤ba \leq x \leq b
2
=1b−a∫abx2 dx= \frac{1}{b-a} \int_{a}^{b} x^2 \, dx
factorTake out the constant
3
=1b−a[x33]ab= \frac{1}{b-a} \left[\frac{x^3}{3}\right]_{a}^{b}
integrateAn antiderivative of x2x^2
4
=1b−a⋅b3−a33= \frac{1}{b-a} \cdot \frac{b^3 - a^3}{3}
evaluateAt the limits bb and aa
5
=b2+ab+a23= \frac{b^2 + ab + a^2}{3}
factorUsing the factorization b3−a3=(b−a)(b2+ab+a2)b^3 - a^3 = (b-a)(b^2 + ab + a^2)
6
Var(X)=b2+ab+a23−(a+b2)2\mathrm{Var}(X) = \frac{b^2 + ab + a^2}{3} - \left(\frac{a+b}{2}\right)^2
key stepThe computational formula, with μ=a+b2\mu = \frac{a+b}{2} from the expected value section
7
=(b−a)212= \frac{(b-a)^2}{12}
simplifyAfter algebraic simplification
Var(X)=(b−a)212\mathrm{Var}(X) = \frac{(b-a)^2}{12}
Deriving the continuous uniform varianceLearn Math Class
Once E[X2]\mathbb{E}[X^2] is reduced to b2+ab+a23\frac{b^2 + ab + a^2}{3}, the gold step subtracts the squared mean, and only the width b−ab - a survives.
The result Var(X)=(b−a)212\mathrm{Var}(X) = \frac{(b-a)^2}{12} shows that variance depends only on the interval width (b−a)(b-a). The divisor of 12 appears because probability mass is spread uniformly—not concentrated anywhere. A wider interval means greater spread; location doesn't matter, only the range size.

This formula mirrors the discrete uniform distribution, differing only in technical details between continuous and discrete cases.

Standard Deviation


Variance and Standard Deviation
σ=b−a12=b−a23≈0.289(b−a)\sigma = \frac{b-a}{\sqrt{12}} = \frac{b-a}{2\sqrt{3}} \approx 0.289(b-a)

Example


Suppose a bus arrives randomly between 2:00 PM and 2:30 PM, modeled as uniform on the interval [0,30][0, 30] minutes:

Variance and Standard Deviation
Var(X)=(30−0)212=90012=75 minutes2\mathrm{Var}(X) = \frac{(30-0)^2}{12} = \frac{900}{12} = 75 \text{ minutes}^2

Variance and Standard Deviation
σ=3012≈8.66 minutes\sigma = \frac{30}{\sqrt{12}} \approx 8.66 \text{ minutes}

Pitfall: Dividing the width by 12
Writing σ=b−a12\sigma = \frac{b-a}{12} gives 3012=2.5\frac{30}{12} = 2.5 minutes for the bus. The variance divides the squared width by 1212, so the root takes in the 1212 too: σ=3012≈8.66\sigma = \frac{30}{\sqrt{12}} \approx 8.66 minutes.

The variance of 75 min² and standard deviation of about 8.66 minutes indicate moderate spread. While the expected arrival is 15 minutes after 2:00 PM, typical variations are around ±8.66 minutes, meaning arrivals between roughly 6 and 24 minutes are common.
Only the width of the interval sets the spread: shifting a uniform moves its mean but never its variance.

Mode and Median

Mode


The mode is the value where the probability density function reaches its maximum—the peak of the distribution curve.

For the continuous uniform distribution, every value in the support has the same density:

Mode and Median
Mode=Any value in [a,b]\text{Mode} = \text{Any value in } [a, b]

Intuition: The continuous uniform PDF is constant:

Mode and Median
f(x)=1b−a for a≤x≤bf(x) = \frac{1}{b-a} \text{ for } a \leq x \leq b

Since the density function is flat across the entire interval, there is no single peak. Every point in [a,b][a, b] is equally probable in terms of density, so every value is technically a mode.

This is the continuous analog of the discrete uniform distribution, where all outcomes are equally likely.

Example
For a bus arriving uniformly between 2:00 PM and 2:30 PM (interval [0,30][0, 30] minutes):
Mode = Any value in [0, 30]
There is no "most likely" arrival time—all times are equally probable. The density is constant at f(x)=130f(x) = \frac{1}{30} across the entire half-hour window.

Median


The median is the value mm such that P(X≤m)=0.5P(X \leq m) = 0.5—the point that divides the distribution's probability in half.

For the continuous uniform distribution, the median is:

Mode and Median
Median=a+b2\text{Median} = \frac{a + b}{2}

Derivation: Using the CDF for the uniform distribution:

Mode and Median
F(x)=x−ab−a for a≤x≤bF(x) = \frac{x - a}{b - a} \text{ for } a \leq x \leq b

Setting F(m)=0.5F(m) = 0.5:

Mode and Median
m−ab−a=0.5\frac{m - a}{b - a} = 0.5

Mode and Median
m−a=0.5(b−a)m - a = 0.5(b - a)

Mode and Median
m=a+0.5(b−a)=a+b2m = a + 0.5(b - a) = \frac{a + b}{2}
Solving F(m)=0.5F(m) = 0.5 as a chain of steps, each with what it does.
DownloadPNG2×PDF
FindThe median mm, where P(X≤m)=0.5P(X \leq m) = 0.5
1
m−ab−a=0.5\frac{m - a}{b - a} = 0.5
key stepSetting the CDF F(x)=x−ab−aF(x) = \frac{x - a}{b - a} equal to 0.50.5 at x=mx = m
2
m−a=0.5(b−a)m - a = 0.5(b - a)
multiplyMultiply both sides by b−ab - a
3
m=a+0.5(b−a)=a+b2m = a + 0.5(b - a) = \frac{a + b}{2}
solveAdd aa and simplify
Median=a+b2\text{Median} = \frac{a + b}{2}
Deriving the continuous uniform medianLearn Math Class
Because the CDF is linear in xx, the gold step produces a linear equation, solved in two moves.
Intuition: Because the distribution is perfectly symmetric and uniform, the point that divides probability in half is simply the midpoint of the interval. This also equals the mean, as with all symmetric distributions.

Example:
For a bus arriving uniformly between 2:00 PM and 2:30 PM (interval [0,30][0, 30] minutes):

Mode and Median
Median=0+302=15 minutes\text{Median} = \frac{0 + 30}{2} = 15 \text{ minutes}

Half of arrivals occur before 2:15 PM, and half occur after. This is also the mean arrival time.

Properties:
• For the continuous uniform distribution: median = mean = a+b2\frac{a+b}{2}
• The mode is not uniquely defined (all values equally dense)
• Perfect symmetry ensures median and mean coincide
• The median depends only on the endpoints aa and bb, not on the interval width directly
• This matches the discrete uniform distribution, where the median is also the midpoint

Quantiles/Percentiles


A quantile is a value that divides the distribution at a specific probability threshold. The pp-th quantile xpx_p satisfies:

Quantiles/Percentiles
P(X≤xp)=pP(X \leq x_p) = p

where 0<p<10 < p < 1.

Percentiles are quantiles expressed as percentages: the kk-th percentile corresponds to the quantile at p=k/100p = k/100. For example, the 25th percentile is the 0.25 quantile, the 50th percentile is the median, and the 75th percentile is the 0.75 quantile.

Quantiles are found by inverting the CDF: if F(xp)=pF(x_p) = p, then xp=F−1(p)x_p = F^{-1}(p).

Finding Quantiles for the Continuous Uniform Distribution


For a continuous uniform distribution on the interval [a,b][a, b], the CDF is:

Quantiles/Percentiles
F(x)=x−ab−a for a≤x≤bF(x) = \frac{x - a}{b - a} \text{ for } a \leq x \leq b

To find the pp-th quantile, we solve F(xp)=pF(x_p) = p:

Quantiles/Percentiles
xp−ab−a=p\frac{x_p - a}{b - a} = p

Quantiles/Percentiles
xp−a=p(b−a)x_p - a = p(b - a)

Quantiles/Percentiles
xp=a+p(b−a)x_p = a + p(b - a)
Solving F(xp)=pF(x_p) = p as a chain of steps, each with what it does.
DownloadPNG2×PDF
FindThe pp-th quantile xpx_p, where P(X≤xp)=pP(X \leq x_p) = p
1
xp−ab−a=p\frac{x_p - a}{b - a} = p
key stepSolving F(xp)=pF(x_p) = p with the CDF F(x)=x−ab−aF(x) = \frac{x - a}{b - a}
2
xp−a=p(b−a)x_p - a = p(b - a)
multiplyMultiply both sides by b−ab - a
3
xp=a+p(b−a)x_p = a + p(b - a)
solveAdd aa
xp=a+p(b−a)x_p = a + p(b - a)
Deriving the continuous uniform quantile formulaLearn Math Class
These are the steps of the median with 0.50.5 replaced by pp; at p=0.5p = 0.5 the formula returns the midpoint a+b2\frac{a + b}{2}.
This gives the simple quantile formula:

Quantiles/Percentiles
xp=a+p(b−a)x_p = a + p(b - a)

The pp-th quantile is located a fraction pp of the way from aa to bb along the interval. This linear relationship makes quantiles for the uniform distribution particularly intuitive.

Common Percentiles


25th Percentile (First Quartile, Q1):

Quantiles/Percentiles
x0.25=a+0.25(b−a)=a+b−a4=3a+b4x_{0.25} = a + 0.25(b - a) = a + \frac{b - a}{4} = \frac{3a + b}{4}

About 25% of values fall below this point, located one-quarter of the way from aa to bb.

50th Percentile (Median, Q2):

Quantiles/Percentiles
x0.50=a+0.50(b−a)=a+b−a2=a+b2x_{0.50} = a + 0.50(b - a) = a + \frac{b - a}{2} = \frac{a + b}{2}

This is the median, located exactly at the midpoint.

75th Percentile (Third Quartile, Q3):

Quantiles/Percentiles
x0.75=a+0.75(b−a)=a+3(b−a)4=a+3b4x_{0.75} = a + 0.75(b - a) = a + \frac{3(b - a)}{4} = \frac{a + 3b}{4}

About 75% of values fall below this point, located three-quarters of the way from aa to bb.

Interquartile Range (IQR):

Quantiles/Percentiles
IQR=Q3−Q1=a+3b4−3a+b4=b−a2\text{IQR} = Q3 - Q1 = \frac{a + 3b}{4} - \frac{3a + b}{4} = \frac{b - a}{2}

The IQR spans exactly half the total interval width, containing the middle 50% of the distribution.

Example
For a bus arriving uniformly between 2:00 PM and 2:30 PM (interval [0,30][0, 30] minutes):
25th percentile: 0+0.25(30−0)=7.50 + 0.25(30 - 0) = 7.5 minutes
25% of arrivals occur before 2:07:30 PM.
50th percentile: 0+0.50(30−0)=150 + 0.50(30 - 0) = 15 minutes
Half of arrivals occur before 2:15 PM (the median).
75th percentile: 0+0.75(30−0)=22.50 + 0.75(30 - 0) = 22.5 minutes
75% of arrivals occur before 2:22:30 PM.
IQR: 22.5−7.5=1522.5 - 7.5 = 15 minutes
The middle 50% of arrivals span a 15-minute window from 2:07:30 PM to 2:22:30 PM.

Other Notable Percentiles


Pitfall: Forgetting to add a
Taking xp=p⋅bx_p = p \cdot b for U(10,30)U(10, 30) gives the 25th percentile 0.25⋅30=7.50.25 \cdot 30 = 7.5, below the interval. The quantile starts from aa: x0.25=10+0.25(30−10)=15x_{0.25} = 10 + 0.25(30 - 10) = 15.

10th percentile: x0.10=a+0.10(b−a)x_{0.10} = a + 0.10(b - a) (10% of values below this)

90th percentile: x0.90=a+0.90(b−a)x_{0.90} = a + 0.90(b - a) (90% of values below this)

95th percentile: x0.95=a+0.95(b−a)x_{0.95} = a + 0.95(b - a) (95% of values below this)

For the uniform distribution, every percentile divides the interval proportionally—the pp-th percentile is always located at position pp along the interval from aa to bb. This makes the uniform distribution the simplest case for understanding quantiles.

Real-World Examples and Common Applications


The continuous uniform distribution models situations where any value within an interval is equally likely, representing complete uncertainty within defined bounds.

Common Applications


Random Number Generation:
• Computational random number generators produce uniform [0,1][0,1] values
• Simulations and Monte Carlo methods
• Cryptographic applications
• Statistical sampling algorithms

Scheduling and Timing:
• Random arrival times within a window
• Bus/train arrival when schedule unknown
• Meeting start times with imprecise information
• Random delays or offsets

Physical and Geometric Problems:
• Random point selection on a line segment or interval
• Angle measurements in certain contexts
• Rounding errors in numerical computations
• Random coordinates within bounded regions

Decision Making Under Ignorance:
• Modeling complete uncertainty about a parameter
• Bayesian prior distributions (non-informative priors)
• Initial estimates before data collection

Why It Appears


The uniform distribution represents maximum entropy—when you know only the minimum and maximum possible values, the uniform distribution assumes nothing else. It's the "default" model for complete ignorance within bounds.

It also serves as the foundation for generating other distributions: by transforming uniform [0,1][0,1] random variables using inverse CDF methods, any continuous distribution can be simulated.

Example Application


A digital clock displays time in whole minutes. When you glance at it, the actual time has passed some fraction into the current minute. This fraction is uniformly distributed on [0,1)[0, 1) minutes, with mean 30 seconds.

For scheduling, if a bus arrives "sometime between 2:00 and 2:30" with no further information, modeling arrival time as Uniform(0,30)\text{Uniform}(0, 30) minutes reflects complete uncertainty, giving an expected wait of 15 minutes.
Knowing only a value's bounds leads to the uniform, and uniform numbers in turn can generate any other continuous distribution.
DownloadPNG2×PDF
Random Number Generation
  • Computational random number generators produce uniform [0,1][0,1] values
  • Simulations and Monte Carlo methods
  • Cryptographic applications
  • Statistical sampling algorithms
Scheduling and Timing
  • Random arrival times within a window
  • Bus or train arrival when the schedule is unknown
  • Meeting start times with imprecise information
  • Random delays or offsets
Physical and Geometric Problems
  • Random point selection on a line segment or interval
  • Angle measurements in certain contexts
  • Rounding errors in numerical computations
  • Random coordinates within bounded regions
Decision Making Under Ignorance
  • Modeling complete uncertainty about a parameter
  • Bayesian prior distributions (non-informative priors)
  • Initial estimates before data collection
Continuous uniform distributionany value in an interval equally likely
Common ApplicationsLearn Math Class

Interactive Calculator

Continuous Uniform Distribution Calculator

Calculate probabilities and distribution properties

Lower bound of distribution

Upper bound of distribution


Special Cases


The continuous uniform distribution, while mathematically simple, exhibits several special cases and edge behaviors worth understanding.

Unit Interval Uniform Distribution


When a=0a = 0 and b=1b = 1, we obtain the standard uniform distribution Uniform(0,1)\text{Uniform}(0, 1):

Special Cases
f(x)=1 for 0≤x≤1f(x) = 1 \text{ for } 0 \leq x \leq 1

This is the fundamental distribution in random number generation—all other continuous distributions can be generated by transforming uniform [0,1][0, 1] random variables using the inverse CDF method.

Any uniform random variable X∼Uniform(a,b)X \sim \text{Uniform}(a, b) can be transformed to standard uniform:

Special Cases
U=X−ab−a∼Uniform(0,1)U = \frac{X - a}{b - a} \sim \text{Uniform}(0, 1)

As Interval Width Approaches Zero


As b−a→0b - a \to 0 (with midpoint a+b2\frac{a+b}{2} held constant), the uniform distribution degenerates to a point mass:

Special Cases
lim⁡b→aUniform(a,b)=δa+b2\lim_{b \to a} \text{Uniform}(a, b) = \delta_{\frac{a+b}{2}}

All probability concentrates at a single value. The distribution becomes deterministic—no randomness remains.

As Interval Width Increases


As b−a→∞b - a \to \infty, the interval grows without bound:

• The density f(x)=1b−a→0f(x) = \frac{1}{b-a} \to 0 (probability spreads thinner)
• Variance (b−a)212→∞\frac{(b-a)^2}{12} \to \infty (uncertainty grows)
• The distribution can no longer be normalized over the entire real line

Unlike the normal distribution, a uniform distribution over (−∞,∞)(-\infty, \infty) cannot exist as a proper probability distribution.

Symmetric Interval Around Zero


When a=−ca = -c and b=cb = c for some c>0c > 0, the distribution is symmetric around zero:

Special Cases
X∼Uniform(−c,c)X \sim \text{Uniform}(-c, c)

Properties:
• Mean =0= 0
• Variance =(2c)212=c23= \frac{(2c)^2}{12} = \frac{c^2}{3}
• Useful for modeling symmetric errors or deviations
One row per special choice of the endpoints aa and bb. Click a row for more on what happens there.
DownloadPNG2×PDF
General
f(x)={1b−aif a≤x≤b0otherwisef(x) = \begin{cases} \frac{1}{b-a} & \text{if } a \leq x \leq b \\ 0 & \text{otherwise} \end{cases}
Special choices of the intervalLearn Math Class
Every row is the flat density 1b−a\frac{1}{b-a} read at one choice of interval: its width alone decides how tall the density stands.

Limiting Behavior and Connections


Relationship to Discrete Uniform:
The continuous uniform is the limiting case of the discrete uniform distribution as the number of possible values increases and their spacing decreases:

Special Cases
lim⁡n→∞DiscreteUniform{a,a+Δ,a+2Δ,…,b}→Uniform(a,b)\lim_{n \to \infty} \text{DiscreteUniform}\{a, a + \Delta, a + 2\Delta, \ldots, b\} \to \text{Uniform}(a, b)

where Δ=b−an\Delta = \frac{b-a}{n} as the grid becomes infinitely fine.

Maximum Entropy:
Among all continuous distributions on [a,b][a, b], the uniform distribution has maximum entropy—it represents the state of complete ignorance about where in the interval a value might fall.

Sum of Uniforms:
Unlike the normal distribution, sums of uniform random variables do not remain uniform. Instead, the sum of nn independent Uniform(0,1)\text{Uniform}(0, 1) variables, once standardized, approaches normal by the Central Limit Theorem.

Did you know: About ee draws to pass 1
Add Uniform(0,1)\text{Uniform}(0, 1) numbers one at a time until the total exceeds 11: on average this takes e≈2.718e \approx 2.718 draws. The first nn draws stay at or below 11 with probability 1n!\frac{1}{n!}, and these chances add up to ee.

The shape of the sum changes step by step. Two draws give a triangular density on [0,2][0, 2] with its peak at 11. Three draws give a density made of three pieces of parabolas on [0,3][0, 3], which already looks like a bell. Each new draw adds 12\frac{1}{2} to the mean and 112\frac{1}{12} to the variance, so the sum of nn draws has mean n2\frac{n}{2} and variance n12\frac{n}{12}.

Practical Implications


Measurement Rounding:
Digital instruments that round to the nearest unit create uniform rounding errors on [−0.5,0.5][-0.5, 0.5]. As precision decreases (rounding to nearest 10, 100, etc.), the interval widens proportionally.

Bounded Uncertainty:
When you know a parameter lies between aa and bb but have no other information, the uniform prior represents minimal assumptions—neither favoring high values nor low values within the range.

Properties


The continuous uniform distribution has simple mathematical properties stemming from its constant density across the support interval.

Symmetry


The uniform distribution is perfectly symmetric around its midpoint a+b2\frac{a+b}{2}:

Properties
f(a+b2+x)=f(a+b2−x) for ∣x∣≤b−a2f\left(\frac{a+b}{2} + x\right) = f\left(\frac{a+b}{2} - x\right) \text{ for } |x| \leq \frac{b-a}{2}

This symmetry implies:
• Mean = Median = a+b2\frac{a+b}{2}
• Mode is not uniquely defined (all values equally probable)
• The distribution is mirror-symmetric about its center

Skewness


Properties
Skewness=0\text{Skewness} = 0

Zero skewness confirms perfect symmetry. The uniform distribution has no tendency toward either tail—both sides balance exactly.

Kurtosis


Properties
Kurtosis=1.8\text{Kurtosis} = 1.8

Properties
Excess Kurtosis=−1.2\text{Excess Kurtosis} = -1.2

The uniform distribution has negative excess kurtosis (platykurtic). With kurtosis 1.8 < 3, it has lighter tails than the normal distribution. The flat shape means probability is spread evenly rather than concentrated at the center or in the tails.

Tail Behavior


The uniform distribution has no tails in the traditional sense:

Properties
f(x)={1b−afor a≤x≤b0otherwisef(x) = \begin{cases} \frac{1}{b-a} & \text{for } a \leq x \leq b \\ 0 & \text{otherwise} \end{cases}

Probability density is constant within [a,b][a, b] and exactly zero outside this interval. There is an abrupt cutoff at the boundaries—no gradual decay.

This represents the opposite extreme from heavy-tailed distributions:
• No values outside [a,b][a, b] are possible
• All values within [a,b][a, b] are equally likely
• No concept of "rare extreme events"

Unique Mathematical Properties


Constant Density:
The defining property is uniform density:

Properties
f(x)=1b−a for all x∈[a,b]f(x) = \frac{1}{b-a} \text{ for all } x \in [a, b]

This makes many calculations algebraically simple.

Maximum Entropy on Bounded Interval:
Among all continuous distributions on [a,b][a, b], the uniform distribution has the highest entropy:

Properties
H=ln⁡(b−a)H = \ln(b - a)

It represents maximum uncertainty or minimum information—complete ignorance about where in [a,b][a, b] a value falls.

Did you know: An entropy below zero
For Uniform(0,0.5)\text{Uniform}(0, 0.5) the formula gives H=ln⁡0.5≈−0.69H = \ln 0.5 \approx -0.69. The entropy of a discrete variable is never negative, but the entropy of a density is measured against an interval of length 11, so every shorter interval scores below zero.

The entropy depends only on the width of the interval, never on where it sits: Uniform(0,2)\text{Uniform}(0, 2) and Uniform(100,102)\text{Uniform}(100, 102) both have H=ln⁡2H = \ln 2. Doubling the width adds ln⁡2≈0.69\ln 2 \approx 0.69 to HH, and halving it takes the same amount away, just as the variance (b−a)212\frac{(b-a)^2}{12} ignores the location and follows the width alone.

Probability Proportional to Length:
For any subinterval [c,d]⊆[a,b][c, d] \subseteq [a, b]:

Properties
P(c≤X≤d)=d−cb−aP(c \leq X \leq d) = \frac{d - c}{b - a}

Probability is simply the length of the subinterval divided by the total interval length.

Independence from Location:
The distribution shape depends only on interval width b−ab - a, not on location. Shifting the interval preserves all distributional properties:

Properties
Uniform(a,b)=dUniform(a+c,b+c) for any c\text{Uniform}(a, b) \stackrel{d}{=} \text{Uniform}(a+c, b+c) \text{ for any } c

Useful Identities


Linear Transformation:
If X∼Uniform(a,b)X \sim \text{Uniform}(a, b), then:

Properties
Y=cX+d∼Uniform(ca+d,cb+d) for c>0Y = cX + d \sim \text{Uniform}(ca + d, cb + d) \text{ for } c > 0

Linear transformations preserve uniformity (with appropriate parameter adjustments).

Standardization:
Any uniform variable can be transformed to standard uniform:

Properties
U=X−ab−a∼Uniform(0,1)U = \frac{X - a}{b - a} \sim \text{Uniform}(0, 1)

Inverse CDF Method:
The uniform CDF is:

Properties
F(x)=x−ab−aF(x) = \frac{x - a}{b - a}

with inverse:

Properties
F−1(p)=a+p(b−a)F^{-1}(p) = a + p(b - a)

This makes generating uniform random variables and computing quantiles trivial.

Order Statistics:
For nn independent Uniform(0,1)\text{Uniform}(0, 1) variables, the kk-th order statistic follows a Beta(k,n−k+1)(k, n-k+1) distribution. The minimum and maximum have simple distributions:

Properties
min⁡(X1,…,Xn)∼Beta(1,n),E[min⁡]=1n+1\min(X_1, \ldots, X_n) \sim \text{Beta}(1, n), \qquad E[\min] = \frac{1}{n+1}

Not Closed Under Addition:
Unlike the normal distribution, sums of independent uniform variables do not remain uniform. Instead, the sum approaches normal by the Central Limit Theorem.

Related Distributions


The uniform distribution is the raw material of the others. A computer's random numbers are uniform on (0,1)(0, 1), and every other distribution it draws from is a uniform value passed through a formula.

Any continuous distribution: the inverse CDF


Let UU be uniform on (0,1)(0, 1) and let FF be the CDF of the distribution that is wanted. Then X=F−1(U)X = F^{-1}(U) has that distribution:

Related Distributions
P(X≤x)=P(F−1(U)≤x)=P(U≤F(x))=F(x)P(X \leq x) = P(F^{-1}(U) \leq x) = P(U \leq F(x)) = F(x)

The last step uses the uniform's own rule, P(U≤u)=uP(U \leq u) = u. Read the other way, the same line says that F(X)F(X) is uniform on (0,1)(0, 1) for any continuous variable XX, so the percentile ranks of data are spread evenly.

Exponential: the logarithm of a uniform


The exponential CDF F(x)=1−e−λxF(x) = 1 - e^{-\lambda x} can be inverted by hand, which gives the best-known case of the method. Since 1−U1 - U is uniform as well, UU can stand in for it:

Related Distributions
X=−ln⁡Uλ∼Exp(λ)X = -\frac{\ln U}{\lambda} \sim \text{Exp}(\lambda)

With λ=2\lambda = 2 and a drawn value U=0.3U = 0.3, the wait is −ln⁡0.32≈0.60-\frac{\ln 0.3}{2} \approx 0.60.

Discrete uniform: the same idea on a grid


The discrete uniform distribution spreads probability evenly over finitely many values, and it turns into the continuous one as the grid gets finer, as Special Cases shows. The link also runs back: cut (0,1)(0, 1) into nn equal pieces and record which piece UU lands in, and the result ⌊nU⌋+1\lfloor nU \rfloor + 1 is uniform on 1,2,…,n1, 2, \ldots, n. A die roll is ⌊6U⌋+1\lfloor 6U \rfloor + 1.

Beta: uniform values put in order


The uniform on (0,1)(0, 1) is the beta distribution with both parameters equal to 11. Draw nn independent uniform values and sort them: the kk-th smallest follows Beta(k,n−k+1)\text{Beta}(k, n - k + 1), with mean kn+1\frac{k}{n + 1}. The largest of the nn is the simplest case:

Related Distributions
P(max⁡(U1,…,Un)≤x)=xnP(\max(U_1, \ldots, U_n) \leq x) = x^n

since all nn values must fall at or below xx.

Sums: triangular, then normal


The sum of two independent uniform values on (0,1)(0, 1) has a triangular density on [0,2][0, 2] with its peak at 11. The sum of nn of them follows the Irwin-Hall distribution, which looks like a bell from about n=3n = 3 on and approaches the normal distribution with mean n2\frac{n}{2} and variance n12\frac{n}{12} as nn grows.

Of these, the inverse CDF link matters most in practice: it is how a simulation turns one source of uniform numbers into any distribution it needs.

Continuous Uniform at a Glance

This summary gathers the continuous uniform distribution on one card of ten rows. Each row names one part of the distribution with a line on what it gives and a link to the section that explains it, then states the formula or fact and adds a note or a worked number.

The first rows fix the setup: the two endpoints and the interval between them as the support. Then come the flat density, the running total that rises in a straight line, the mean at the midpoint, the variance with the standard deviation, the mode and median, and the quantile. The last rows give the standard uniform on the unit interval and the example of a bus that arrives at a random moment within half an hour.
DownloadPNG2×PDF
AspectFormula or statementNote or example
ParametersThe two endpoints that fix the distribution, as the parameters section explains.a,b∈Ra, b \in \mathbb{R} with a<ba < bthe endpoints of the interval; width b−ab - a
SupportEvery value between the endpoints, set out with the PDF and its support.x∈[a,b]x \in [a, b]the density is zero outside the interval
PDFThe constant density over the interval, from the PDF section.f(x)={1b−aif a≤x≤b0otherwise\displaystyle f(x) = \begin{cases} \frac{1}{b-a} & \text{if } a \leq x \leq b \\ 0 & \text{otherwise} \end{cases}a flat rectangle of height 1/(b−a)1/(b - a) and width b−ab - a; total area 11
CDFThe probability of a value up to xx, from the CDF section.F(x)={0if x<ax−ab−aif a≤x≤b1if x>b\displaystyle F(x) = \begin{cases} 0 & \text{if } x < a \\ \frac{x-a}{b-a} & \text{if } a \leq x \leq b \\ 1 & \text{if } x > b \end{cases}a linear ramp: probability scales with the length of the subinterval
Expected valueThe balance point of the interval, derived in the expected value section.E[X]=a+b2\displaystyle E[X] = \frac{a + b}{2}the midpoint of the interval
VarianceHow widely the values spread around the midpoint, worked out in variance and standard deviation.Var(X)=(b−a)212\displaystyle \mathrm{Var}(X) = \frac{(b-a)^2}{12}; σ=b−a12\displaystyle \sigma = \frac{b-a}{\sqrt{12}}depends only on the width of the interval, not on its location
Mode and medianThe middle sits at the midpoint and no value is more likely than another, as mode and median shows.Median=a+b2\displaystyle \text{Median} = \frac{a + b}{2}; the mode is not uniquely defined, since every value in [a,b][a, b] qualifiesperfectly symmetric: mean, median and midpoint coincide
Quantile functionThe value below which a share pp of the interval lies, solved in quantiles and percentiles.xp=a+p(b−a)x_p = a + p(b - a) for 0<p<10 < p < 1linear; the basis of the inverse-CDF sampling method
Standard caseAny uniform variable rescales to the unit interval, as special cases shows.Uniform⁡(0,1)\operatorname{Uniform}(0, 1), the standard uniform distributionthe basis of random-number generation; (X−a)/(b−a)∼U(0,1)(X - a)/(b - a) \sim U(0, 1)
Canonical exampleThe bus-arrival setting the page works through; variance and standard deviation finishes its numbers.a bus arriving uniformly between 2:00 and 2:30 PM: [0,30][0, 30] minutesE[X]=15E[X] = 15 min, Var(X)=75 min2\mathrm{Var}(X) = 75 \text{ min}^2, σ≈8.66\sigma \approx 8.66 min
Continuous uniform distribution at a glance·All probability formulasLearn Math Class
On this distribution a probability is simply a length: the share of the interval that an event covers. The mean and median sit at the midpoint, and the spread depends on the width alone, so moving the interval changes neither the variance nor the shape.

Common Pitfalls

Each of the four mistakes below is marked where it happens in the sections above; here each is worked through in full, with the wrong and the right working side by side.
DownloadPNG2×PDF
1Extending the ramp past b
A probability P(c≤X≤d)P(c \leq X \leq d) is found from the CDF, but one end of the window lies outside the interval [a,b][a, b], and the middle line x−ab−a\frac{x-a}{b-a} of the CDF is used there anyway.
Start
For X∼U(0,10)X \sim U(0, 10),
Wrong turn
Error here
P(8≤X≤15)=15−010−8−010P(8 \leq X \leq 15) = \frac{15 - 0}{10} - \frac{8 - 0}{10}

=1.5−0.8=0.7= 1.5 - 0.8 = 0.7
Right path
Above b=10b = 10 the CDF equals 11, so F(15)=1F(15) = 1.
P(8≤X≤15)=F(15)−F(8)P(8 \leq X \leq 15) = F(15) - F(8)

=1−0.8=0.2= 1 - 0.8 = 0.2
Why it happensThe shortcut d−cb−a\frac{d-c}{b-a} is quick and is shown for windows inside the interval, so it gets applied to any window. It holds only when a≤c≤d≤ba \leq c \leq d \leq b.
How to checkA CDF value can never exceed 11, so F(15)=1.5F(15) = 1.5 is a warning sign. Cutting the window to the part inside the interval first gives the same answer: [8,15][8, 15] becomes [8,10][8, 10], a length of 22 out of 1010.
2Halving the width
The mean of a uniform distribution is the midpoint of the interval, and the midpoint is mixed up with half the length of the interval.
Start
For X∼U(2,8)X \sim U(2, 8),
Wrong turn
Error here
E[X]=b−a2=8−22=3E[X] = \frac{b-a}{2} = \frac{8-2}{2} = 3
Right path
The midpoint is the average of the two endpoints.
E[X]=a+b2=2+82=5E[X] = \frac{a+b}{2} = \frac{2+8}{2} = 5
Why it happensThe bus example starts at a=0a = 0, where b−a2\frac{b-a}{2} and a+b2\frac{a+b}{2} both equal b2\frac{b}{2}, so the wrong formula gives the right answer there. The difference shows only when a≠0a \neq 0.
How to checkShift the interval. Moving U(2,8)U(2, 8) to U(102,108)U(102, 108) must move the mean by 100100, from 55 to 105105; the half-width 33 does not move at all, so it cannot be the mean.
3Dividing the width by 12
The standard deviation is needed, and the divisor 1212 from the variance formula is applied to the width directly, without its square root.
Wrong turn
Error here
For the bus on [0,30][0, 30] minutes,
σ=b−a12=3012=2.5 minutes\sigma = \frac{b-a}{12} = \frac{30}{12} = 2.5 \text{ minutes}
Right path
The variance divides the squared width by 1212, and the standard deviation is the square root of the whole fraction.
Var(X)=30212=75,\mathrm{Var}(X) = \frac{30^2}{12} = 75,

σ=75=3012\sigma = \sqrt{75} = \frac{30}{\sqrt{12}}

≈8.66 minutes\approx 8.66 \text{ minutes}
Why it happensThe 1212 is the memorable part of the formula, and the square root is taken of the top only: (b−a)2=b−a\sqrt{(b-a)^2} = b - a is used, 12\sqrt{12} is forgotten.
How to checkFor any uniform distribution the standard deviation is about 0.2890.289 of the width, so a 30-minute window must give close to 8.78.7 minutes. A value of 2.52.5 minutes would keep almost every arrival within a few minutes of 2:15, which a flat density over the whole half hour does not do.
4Forgetting to add a
A quantile is found with xp=a+p(b−a)x_p = a + p(b - a), and the formula is shortened to p⋅bp \cdot b, which is correct only when the interval starts at 00.
Start
For X∼U(10,30)X \sim U(10, 30),
Wrong turn
Error here
x0.25=0.25⋅30=7.5x_{0.25} = 0.25 \cdot 30 = 7.5
Right path
The quantile lies a fraction pp of the width beyond the starting point aa.
x0.25=a+0.25(b−a)x_{0.25} = a + 0.25(b - a)

=10+0.25⋅20=15= 10 + 0.25 \cdot 20 = 15
Why it happensThe worked percentiles on this page use the bus interval [0,30][0, 30], where a=0a = 0 and the two formulas agree.
How to checkEvery quantile must lie inside the interval, and 7.57.5 is below a=10a = 10, a value the variable never takes. Substituting back confirms the right answer: F(15)=15−1030−10=0.25F(15) = \frac{15 - 10}{30 - 10} = 0.25.
Common pitfalls with the continuous uniform distribution·/probability/distributions/continuous/uniformLearn Math Class
Each slip loses track of the interval [a,b][a, b]. The CDF stays at 11 past bb, the mean is the midpoint a+b2\frac{a + b}{2}, the standard deviation is b−a12\frac{b - a}{\sqrt{12}}, and a quantile starts from aa: xp=a+p(b−a)x_p = a + p(b - a). Checking that every value lies in the interval, and that no probability exceeds 11, catches each slip.

Skills You Should Learn

Each skill opens its step-by-step method page. Skills marked "On this page" are taught above.
Taught on this page
More distribution methods

Continuous Uniform Distribution FAQ

Are the numbers in U(a, b) a centre and a spread?

+
No — they are the interval's two endpoints. Unlike every other continuous family, the parameters say where the distribution sits, not how much it varies. Reading U(2, 8) as centre 2 with width 8 — the habit N(μ, σ²) teaches — inverts the model. The centre here is (a + b)/2, which has to be computed rather than read off.Read more →

Why is the uniform density 1/(b − a) with no +1?

+
Because it measures an interval rather than counting values. The height is whatever makes the area equal one, so it is the reciprocal of the width — nothing to add. The discrete uniform's 1/(b − a + 1) counts the integers from a to b inclusive, which is a different job. Measuring has no fencepost problem.Read more →

Does it matter whether the interval is written [a, b] or (a, b)?

+
Not here. The endpoints are two points in an uncountable interval, so including or excluding them changes no probability — sources use brackets, parentheses or any mix for the same distribution. On the discrete uniform the same edit deletes an outcome and rescales everything. What does matter is a < b: at a = b the width and the density's denominator collapse together.Read more →

Where does the 12 in the uniform variance come from?

+
From 13−14\frac{1}{3} - \frac{1}{4}. On [0,1][0, 1] the mean is 12\frac{1}{2} and E[X2]=∫01x2 dx=13E[X^2] = \int_0^1 x^2\,dx = \frac{1}{3}, so the variance is 13−14=112\frac{1}{3} - \frac{1}{4} = \frac{1}{12}. Stretching the interval to width b−ab - a multiplies every distance from the mean by b−ab - a, and the variance by (b−a)2(b-a)^2; shifting it changes nothing. That gives (b−a)212\frac{(b-a)^2}{12} for every uniform.Read more →

Can a uniform distribution cover the whole real line?

+
No, not as a probability distribution. A constant density cc over (−∞,∞)(-\infty, \infty) has total area 00 if c=0c = 0 and infinite area if c>0c > 0, never 11. Widening [a,b][a, b] shows the same thing: the height 1b−a\frac{1}{b-a} falls toward 00 and the variance (b−a)212\frac{(b-a)^2}{12} grows without bound. The normal can spread over every real number only because its tails thin out.Read more →

How are uniform random numbers used to simulate other distributions?

+
Through the inverse CDF. If U∼U(0,1)U \sim U(0, 1) and FF is an invertible CDF, then X=F−1(U)X = F^{-1}(U) has CDF FF, because P(F−1(U)≤x)=P(U≤F(x))=F(x)P(F^{-1}(U) \le x) = P(U \le F(x)) = F(x). For example, the exponential quantile function turns UU into −ln⁡(1−U)λ-\frac{\ln(1 - U)}{\lambda}, an exponential wait with rate λ\lambda. This is why U(0,1)U(0, 1) sits under nearly all computer-generated randomness.Read more →