Uniform Distribution

The uniform distribution assigns equal probability density to every value across a fixed range: for a continuous uniform variable on the interval from a to b, the density is the constant 1/(b − a) inside the interval and zero outside, so the probability of landing in any sub-interval is simply that sub-interval's length divided by the total length. A discrete uniform variable is the same idea for a finite set, such as a fair die, where each of the 6 faces has probability 1/6. Because its density graph is a rectangle, it is also called the rectangular distribution, and it is the mathematical formalization of the phrase chosen at random in the most literal sense: no region is favored over any other.

The uniform's moments follow directly from its symmetry and width: the mean and median are both the midpoint (a + b)/2, and the variance is (b − a)^2 / 12. For a variable uniform between 0 and 10, the mean is 5, the variance is 100/12 ≈ 8.33 and the standard deviation about 2.89, and the probability of falling between 2 and 5 is 3/10 = 0.3, no integration required. The factor of 12 is not arbitrary: it comes from integrating the squared distance from the midpoint over the interval. Among all distributions confined to a bounded interval, the uniform is the one with maximum entropy, which is the formal sense in which it expresses no preference among values.

Uniform distribution every value in the interval equally likely: probability is proportional to length Density of Uniform(0, 10): flat at 1/10 0 2 5 10 shaded: P(2 < X < 5) = 3 × 0.1 = 0.3 height 1/(b − a) = 0.1 Key numbers and the U(0, 1) toolkit mean = (a + b) / 2 = 5 variance = (b − a)^2 / 12 ≈ 8.33 std dev = (b − a) / √12 ≈ 2.89 median = mean (perfectly symmetric) U = random() between 0 and 1 → apply inverse CDF: F^(-1)(U) simulates any distribution → p-values are Uniform(0, 1) when the null is true

The standard uniform, Uniform(0, 1), is the engine of simulation. Every computer-generated random number from a library starts as a (pseudo-)random draw between 0 and 1, produced by an algorithm such as the Mersenne Twister of Matsumoto and Nishimura (1997–98) that is designed to mimic uniform independent draws. From that single source, any other distribution can be generated by inverse transform sampling: feed the uniform draw into the inverse of the target's cumulative-distribution-function. Monte Carlo methods, bootstrap resampling, random train/test splits, stochastic gradient descent's mini-batch shuffling, randomized experiments and cryptographic nonces all begin with uniform randomness, and the quality of a random number generator is largely judged by how well its output passes tests for uniformity and independence.

Uniformity also appears as a diagnostic: when a null hypothesis is true and the test statistic is continuous, the resulting p-value is itself uniformly distributed between 0 and 1. This is why a histogram of p-values from many tests of true nulls is flat, why a spike near zero signals real effects or a problem with the analysis, and why probability integral transform plots are used to check whether a forecasting model's predicted distributions are well calibrated. The same principle underlies random-sampling procedures, where each unit's probability of selection should be uniform across the frame, and the discrete uniform is the model for a fair lottery, a shuffled deck or a well-designed randomization of patients to treatment arms.

Uniform(0, 10)
a = 0, b = 10, density 1/10
Everything comes from the width
P(2 &lt; X &lt; 5)
3 / 10 = 0.3
Mean
(0 + 10) / 2 = 5
Variance
100 / 12 about 8.33
Rescale to Uniform(0, 1)
U = X / 10, the building block of simulation
Plug U into any inverse CDF
draws from normal, exponential, and other distributions

The central misconception is that a uniform prior or a uniform model means knowing nothing, or that random-looking data should look evenly spread. A flat prior on a parameter is not flat on a transformed version of it (uniform on a probability p is not uniform on the odds), so choosing it is itself a substantive assumption. Likewise, truly uniform random sequences contain streaks and clusters far more often than intuition expects, and a stretch of data that looks suspiciously even is, if anything, less random than one with clumps. Finally, the uniform has hard edges: if a variable's range is unknown or soft, assuming a sharp uniform interval will badly misstate the probabilities near the boundaries.

Read the uniform distribution as probability in its most even-handed form, where chance equals length, and as the raw material of computational randomness: every random draw a program makes begins as a uniform number that is then bent into any other distribution by an inverse CDF.

Take uniform distribution further

Ask the copilot about this term, or have our engineers assess it against your process.