The continuous uniform distribution (why probability becomes “length”)
The continuous uniform distribution is the simplest continuous probability model.
It describes a random variable \(X\) that is equally likely to fall anywhere inside a finite interval.
When we write \(X\sim\mathrm{Unif}[m,M]\), we mean the support of \(X\) is the interval \([m,M]\) and the density is constant there.
The probability density function (PDF) is
\[
f(x)=\frac{1}{M-m}\quad\text{for }x\in[m,M],\qquad f(x)=0\text{ otherwise.}
\]
Because the PDF is flat, the total area under the curve on \([m,M]\) is \(1\), which forces the height to be \(1/(M-m)\).
Interval probabilities: area = length ratio
For continuous distributions, probabilities are areas under the density curve.
For the uniform distribution, the “area under the curve” over an interval \((a,b)\) becomes a rectangle:
width = the part of \((a,b)\) that lies inside \([m,M]\), and height = \(1/(M-m)\).
That is why
\[
P(a<X<b)=\int_a^b f(x)\,dx
=\frac{\text{length}\big((a,b)\cap[m,M]\big)}{M-m}.
\]
If \(a\) and \(b\) are fully inside the support, the overlap length is simply \(b-a\).
If your interval extends beyond the support, only the overlap counts (anything outside \([m,M]\) has probability 0).
Also note that endpoints do not change the probability: for continuous \(X\), \(P(X=a)=0\), so \(P(a<X<b)=P(a\le X\le b)\).
Mean and variance
The uniform distribution is symmetric about the midpoint of the interval.
Its mean is the center:
\[
\mathbb{E}[X]=\frac{m+M}{2}.
\]
The variance measures the spread and depends only on the interval length:
\[
\mathrm{Var}(X)=\frac{(M-m)^2}{12},\qquad \sigma=\sqrt{\mathrm{Var}(X)}.
\]
A wider interval increases variance quadratically, which matches the idea that values can deviate farther from the mean.
How to use this tool
First enter the support \(\text{min}=m\) and \(\text{max}=M\). Then enter the interval bounds \(a\) and \(b\).
The calculator reports the overlap interval \((a,b)\cap[m,M]\), its length, and the final probability as a decimal (and percent).
It also displays the PDF height \(1/(M-m)\), plus \(\mathbb{E}[X]\) and \(\mathrm{Var}(X)\).
The interactive plot shows a flat density segment on \([m,M]\) and shades the area corresponding to \(P(a<X<b)\).
Press Play to animate how the shaded region grows from the overlap’s left endpoint to its right endpoint.
You can pan and zoom to inspect small intervals or wide supports.
University tease: multivariate uniform
In higher-level probability, “uniform” can also mean uniform over a region in \(\mathbb{R}^2\) or \(\mathbb{R}^n\)
(for example, uniform points in a rectangle, disk, or polytope). The same principle holds:
probability is proportional to area or volume of overlap, normalized by the region’s total area/volume.