Uniform distribution

No value in the interval [a, b] is any more likely than another. The PDF is a flat rectangle — the simplest distribution you can write down.

00.20.40.60.811.200.20.40.60.81xdensity
Solid line: PDF = 1/(b−a) = 1.000 on [0.0, 1.0]. Mean = 0.50, Std = 0.29. Dashes: mean. 500 samples.

What to notice

  • Move a or b and the height adjusts so the area stays exactly 1 — the PDF scales as 1/(b−a).
  • The mean sits at the midpoint. The standard deviation depends only on the width, not the location.
  • Even this maximally flat distribution produces a histogram that looks roughly uniform — but average several uniforms together and the histogram rapidly becomes bell-shaped.

Generating other distributions

The uniform distribution is the foundation of random number generation. A uniform(0,1) sample u can be transformed into any other distribution via its inverse CDF: if F is the CDF of the target distribution, then F⁻¹(u) has that target distribution. This is the inverse transform method, and it’s how many of the samplers on this site work.

Connection to the Central Limit Theorem

Sum n independent uniform draws and divide by n. Even for n=3 or n=4 the histogram looks convincingly normal. By the Central Limit Theorem this is expected — sums of any i.i.d. distribution with finite variance converge to a normal. The uniform is a popular illustration because the starting shape is maximally unlike a bell curve.