Skip to content

Continuous uniform distribution

A flat density on finite bounds turns interval length into probability. Learn its CDF, quantiles, moments and shift-and-scale construction through a synthetic execution delay.

A continuous uniform distribution spreads probability at a constant density over a finite interval. If X∼Uniform(a,b)X\sim\text{Uniform}(a,b), where a<ba<b are finite, any two subintervals of the same length inside [a,b][a,b] have the same probability. This is a particular continuous random variable, with a flat rather than bell-shaped density.
For a quant, it is a useful controlled assumption: a bounded random delay can be generated with two endpoints, and changing those endpoints has transparent effects. But knowing only the minimum and maximum does not establish uniformity. Equal weighting across the interval is an additional modelling choice.

A bounded delay in an execution experiment

Suppose a hypothetical execution simulator inserts a random delay TT before submitting an order. Delays are stipulated to be uniform between 0 and 10 milliseconds. This is a synthetic scheduling rule, not an estimate of exchange latency or a promise that a real order fills within 10 ms.
fT(t)={0.1 per ms,0≤t≤10 ms,0,otherwise.f_T(t)= \begin{cases} 0.1\text{ per ms}, & 0\le t\le10\text{ ms},\\ 0, & \text{otherwise}. \end{cases}
The density's units matter: multiplying 4 ms of width by 0.1 per ms gives the dimensionless probability
P(2 ms<T≤6 ms)=6−210−0=0.4.\mathbb{P}(2\text{ ms}<T\le6\text{ ms}) =\frac{6-2}{10-0}=0.4.

Every 4 ms subinterval entirely inside the support has probability 0.4. A partly overlapping interval receives probability only from its overlap with [0,10][0,10]; extending an interval beyond the upper bound does not create extra probability.

Synthetic delay uniform from 0 to 10 milliseconds. The PDF has height 0.1 per millisecond, with area 0.4 between 2 and 6 milliseconds. The CDF gives F(2)=0.2 and F(6)=0.6, so the same probability is their difference, 0.4.
Synthetic delay uniform from 0 to 10 milliseconds. The PDF has height 0.1 per millisecond, with area 0.4 between 2 and 6 milliseconds. The CDF gives F(2)=0.2 and F(6)=0.6, so the same probability is their difference, 0.4.
Original synthetic model. The left panel calculates an interval's rectangle area; the right calculates the same probability as a rise in the CDF.

There is no probability lump at either endpoint: P(T=0)=P(T=10 ms)=0\mathbb{P}(T=0)=\mathbb{P}(T=10\text{ ms})=0. Including or excluding those points leaves the distribution unchanged. “Equally likely” describes equal-length intervals; individual exact values all have probability zero. The value assigned to the density at one endpoint does not change any probability.

The CDF, quantiles and moments come straight from the width

For general bounds, the cumulative distribution function is
FX(x)={0,x<a,x−ab−a,a≤x≤b,1,x>b.F_X(x)= \begin{cases} 0, & x<a,\\ \dfrac{x-a}{b-a}, & a\le x\le b,\\ 1, & x>b. \end{cases}
It accumulates linearly across the interval. For a≤c≤d≤ba\le c\le d\le b, the interval probability is (d−c)/(b−a)(d-c)/(b-a). Outside that range, use the piecewise CDF and compute FX(d)−FX(c)F_X(d)-F_X(c) instead of blindly dividing the full interval length by b−ab-a. NIST's uniform-distribution reference gives the density, standard CDF and inverse-CDF forms.
Inverting the middle branch gives the quantile function, for 0<p<10<p<1:
QX(p)=a+(b−a)p.Q_X(p)=a+(b-a)p.

The delay's 95th percentile is therefore QT(0.95)=9.5 msQ_T(0.95)=9.5\text{ ms}: the stipulated model assigns probability 0.95 to delays no greater than 9.5 ms. This percentile is a property of the whole distribution, not its mean.

E[X]=a+b2,Var(X)=(b−a)212.\mathbb{E}[X]=\frac{a+b}{2}, \qquad \text{Var}(X)=\frac{(b-a)^2}{12}.
For the delay, these are 5 ms and 100/12≈8.3333 ms2100/12\approx8.3333\text{ ms}^2. The mean is the midpoint; variance depends on the square of the width. A shift of both bounds moves the mean without changing variance. Doubling the width multiplies variance by four.

One standard uniform generates the whole family

If U∼Uniform(0,1)U\sim\text{Uniform}(0,1), then the transformation

X=a+(b−a)UX=a+(b-a)U

has the required distribution: for a≤x≤ba\le x\le b, P(X≤x)=P(U≤(x−a)/(b−a))=(x−a)/(b−a)\mathbb{P}(X\le x)=\mathbb{P}(U\le(x-a)/(b-a))=(x-a)/(b-a). Conversely, (X−a)/(b−a)(X-a)/(b-a) is standard uniform. This is the simplest example of inverse-transform sampling.

The distinction between location and width prevents a common software mistake: some interfaces take a lower bound and an upper bound, while others take a location and a scale. For this family, scale means b−ab-a, not the upper bound or standard deviation. The TU Delft treatment connects the standard uniform to simulation through inverse CDFs.
Changing the time unit also changes the density height. The same delay is uniform from 0 to 0.01 seconds, with density 100 per second. The probability of the interval from 0.002 to 0.006 seconds is still 0.4. A taller numerical density after converting units does not make the event more likely.

A flat density does not mean memorylessness

After learning that the delay has already exceeded 2 ms, only the remaining interval from 2 to 10 ms is available. Thus

P(T>6 ms∣T>2 ms)=10−610−2=0.5,\mathbb{P}(T>6\text{ ms}\mid T>2\text{ ms}) =\frac{10-6}{10-2}=0.5,
whereas the probability of exceeding 4 ms from the start is P(T>4 ms)=0.6\mathbb{P}(T>4\text{ ms})=0.6. Waiting 2 ms changes the distribution of the remaining wait. Uniform delays lack the memoryless property associated with the exponential distribution.

The finite upper bound is an equally strong assumption: this model assigns zero probability to any delay beyond 10 ms. If queueing, outages or load spikes can produce longer waits, the bounds or the distribution need changing. A uniform model also says nothing about dependence between successive delays. Use it deliberately for a controlled experiment, and validate it before treating it as a description of actual execution conditions.

For the density integral and derivation of the moments, see “The Uniform distribution” in Continuous Random Variables and Probability Density Functions. For the broader simulation construction, §1.3 of Random Number Generation develops inversion. Both full lessons require membership; their public pages provide previews.

Sources

Last updated
  • uniform distribution
  • probability
  • continuous distributions
  • simulation
  • quantiles
← Back to the glossaryBack to top ↑