Uniform Distributions
Assign equal mass across finite outcomes or equal density across a bounded interval. Compute probabilities from counts or lengths, derive the CDF and moments, and generate continuous samples by scaling a standard uniform variable.
A uniform distribution assigns equal probability mass to each allowed discrete outcome or equal probability density across a bounded continuous interval. The word “uniform” describes this equal weighting; it does not mean that every possible value in the universe is equally likely.
Discrete Uniform Outcomes
A fair die is uniform over the finite set . Its mass function is:
For a discrete uniform distribution over outcomes, each outcome has mass . An event containing allowed outcomes has probability .
Exercise: Compute a discrete uniform probability
An integer is chosen uniformly from . What is the probability that it is divisible by two?
Compute it first, then check your number.
HintCount allowed outcomes in the event
Four of the eight integers are even.
SolutionDivide favorable outcomes by all equally weighted outcomes
The event is , so:
Uniformity justifies assigning the same mass to every allowed integer; without equal masses, counting outcomes would not be sufficient.
Constant Density on an Interval
For a continuous variable with , the density is:
“The density of at is one over when lies from to , and zero otherwise.” The constant height makes probability proportional to interval length.
The height is the reciprocal of the support width, making the total rectangular area one. Probability belongs to interval area, not density at an exact point:
whenever . Including or excluding endpoints does not change this probability because each exact point has probability zero.
Exercise: Compute a continuous uniform interval probability
Let . What is ?
Compute it first, then check your number.
HintCompare the two interval widths
The event width is and the support width is .
SolutionUse rectangular density area
The probability is:
The calculation is rectangular area: event width times density . The endpoints contribute no additional point mass.
Clip Events to the Support
If an event extends beyond , only its overlap with the support contributes probability. For :
More generally, the interval probability is the overlap length divided by the support length. A requested interval entirely outside the support has probability zero.
Exercise: Clip an interval to uniform support
If , what is ?
Compute it first, then check your number.
HintUse only the overlap with the support
The overlap is inside support .
SolutionDivide overlap length by support length
The overlap has width and the support has width , so:
CDF, Mean, and Variance
The cumulative distribution function is:
It rises linearly across the support. Symmetry places the mean at the midpoint, but the same result follows directly from integration:
The second moment is:
Subtracting the square of the mean gives:
Shifting both endpoints moves the mean without changing variance. Multiplying the interval width by multiplies variance by .
Exercise: Read a uniform CDF
If , what is ?
Compute it first, then check your number.
HintMeasure accumulated support length
Use .
SolutionAccumulate density from the lower endpoint
Since lies inside the support,
Half of the support length, and therefore half of the probability, lies at or below .
Exercise: Compute a uniform mean
For , what is ?
Compute it first, then check your number.
HintFind the midpoint of the support
Average the two endpoints.
SolutionUse symmetry around the midpoint
The mean is:
The constant density is symmetric around this midpoint, so values equally far below and above balance one another.
Exercise: Compute a uniform variance
For , what is ?
Compute it first, then check your number.
HintSquare the support width and divide by twelve
The support width is .
SolutionUse the squared interval width
The variance is:
Shifting the same width to a different location would leave this variance unchanged.
Generate Uniform Samples by Scaling
If , then:
is uniform on . Random-number libraries commonly begin with values that behave like uniform samples and transform them to produce other distributions. These are pseudorandom algorithmic values, so a seed can reproduce the same sequence.
Compare uniform density with simulated samples
Change the endpoints, sample count, or seed. The histogram is shown as density so it can be compared with the theoretical height.
Ready to run.
Before Using a Uniform Model
State whether the model is discrete or continuous and identify its support. Equal density is an assumption about the data-generating process, not a default for every bounded variable. Use counts for discrete uniform events and lengths or areas for continuous ones; never treat density height as point probability.
The next lesson studies the normal distribution, whose density varies across an unbounded support and concentrates probability near a center.