The story
Pick a point at random on a ruler between and , with no preference for any part. The chance of landing in any sub-interval depends only on its length: . The CDF is therefore a straight ramp rising from 0 at to 1 at .
Its mean is the midpoint and its variance is . The Uniform(0, 1) is also the raw material of simulation: computers generate uniform random numbers and transform them into everything else, for instance by feeding them through an inverse CDF.
Formulas
Support
CDF
Expectation
Variance
Parameters
| Parameter | What it controls |
|---|---|
| The lower end of the interval. Keep it below . | |
| The upper end of the interval. Wider intervals give a lower, flatter rectangle, since the total area must stay 1. |
Where it shows up
- The output of a random number generator such as Math.random(), on .
- The rounding error when a measurement is rounded to the nearest unit, roughly uniform on .
- The arrival time of a bus that comes once every ten minutes, if you turn up at a random moment.
- The angle at which a spun bottle comes to rest, uniform on .
Try this
- Set and , then toggle to the CDF view: it is a straight line, so is simply . Shade from 0.2 to 0.5 and confirm the probability is 0.3.
- With and , switch to Sample means with . The averages form a triangle, not a rectangle. Try and then and watch the Central Limit Theorem take over.
- Press Draw 1000 on Uniform(0, 1) and compare the sample variance with . Then widen to 4 and check that the variance grows to , because it scales with the square of the width.
Related distributions
- It is the continuous counterpart of the Discrete Uniform.
- Uniform(0, 1) is the Beta with .
- If is Uniform(0, 1), then is Exponential with rate ; this is the inverse-CDF trick in action.
- The mean of independent Uniforms tends to a Normal as grows; even already looks convincingly bell-shaped.