The Uniform Distribution
The "no information" distribution — every outcome in a range is equally likely, so the density is a flat rectangle. It is the humble seed from which every other random draw is grown on a computer.
Prerequisites: Random Variables & Distributions
The uniform distribution is the simplest continuous distribution there is: every value inside some interval is exactly as likely as every other, and nothing outside the interval can happen. Picture spinning a well-balanced pointer, or a random number generator handing you a value between 0 and 1, no spot is favoured. Because it plays no favourites, it's the natural model for "I know the range but nothing more," and it's the raw material every simulation starts from.
For a continuous uniform on the interval , the density is a flat plateau. To make the total area equal 1, the height must be one over the width:
Here and are the lower and upper ends of the range, and is the width. Widen the interval and the rectangle gets shorter; narrow it and it gets taller, always enclosing an area of exactly 1.
Centre and spread
Because the shape is a symmetric rectangle, the mean is simply the midpoint, and the variance has a tidy closed form:
The mean is obvious, the middle of the range. The variance being width-squared over twelve is a fact worth memorising: it turns up constantly, for example when you approximate rounding error (a rounded number is off by a uniform amount, giving the "quantisation noise" variance).
Everything about a continuous uniform comes from its two endpoints: mean is the midpoint , and variance is . The flat density means outcomes carry the least possible structure, maximum uncertainty for a fixed range.
The seed of all randomness
Here's the uniform's secret importance. Almost every random draw your computer makes, normal, exponential, whatever, is manufactured from uniform draws. The trick is the inverse-transform method: generate a uniform on , then feed it through the inverse of the target distribution's cumulative function. For the The Exponential Distribution, for instance, turns a flat uniform into an exponential wait. So the unassuming rectangle is the foundation under Monte Carlo Integration and every simulation you'll ever run.
Any distribution can be sampled from a single Uniform(0,1) draw : compute , where is the inverse of the target's cumulative distribution. It's why the uniform is the atom of every random-number generator.
Worked example
A shuttle is equally likely to arrive at any moment in the next 10 minutes, model its arrival time as uniform on .
- Average wait: minutes.
- Spread: , so the standard deviation is minutes.
- Chance you wait more than 7 minutes: the favourable region is the interval , of width 3, out of a total width of 10,
For a continuous uniform, probabilities are just lengths: the chance of landing in any sub-interval is that sub-interval's width divided by the total width. No integration required, you're measuring a slice of the rectangle.
Where it misleads
- "Random" is ambiguous. "Pick a random chord of a circle" has several equally reasonable uniform setups that give different answers (Bertrand's paradox). Always pin down what is being drawn uniformly.
- Discrete vs continuous. A die is discrete uniform (six equal lumps); a spinner is continuous uniform. The mean formula is the same midpoint, but the discrete variance is , not .
- Flat is a strong claim. Real "anything in a range" quantities usually aren't perfectly flat, most values cluster somewhere. Uniform is the honest choice only when you genuinely have no reason to prefer any value.
The uniform is the plainest of the Common Distributions, the launchpad for Order Statistics (the min, max, and median of several uniform draws have elegant formulas), and, via inverse-transform sampling, the engine behind Monte Carlo Integration.
Practice in interviews
Further reading
- Blitzstein & Hwang, Introduction to Probability, ch. 5
- Ross, A First Course in Probability