# Uniform distribution¶

## Story¶

Outcomes are restricted to a given continuous range and every outcome in that range has equal probability.

## Example¶

Anything in which all possibilities are equally likely. This is, perhaps surprisingly, rarely encountered.

## Parameters¶

The Uniform distribution is not defined on an infinite or semi-infinite domain, so finite lower and upper bounds, $$\alpha$$ and $$\beta$$, respectively, are necessary parameters.

## Support¶

The Uniform distribution is supported on the interval $$[\alpha, \beta]$$.

## Probability density function¶

\begin{split}\begin{align} f(y;\alpha, \beta) = \left\{\begin{array}{ccl}\frac{1}{\beta-\alpha}&&\alpha\le y\le\beta\\[0.5em] 0 && \text{otherwise.}\end{array}\right. \end{align}\end{split}

## Moments¶

Mean: $$\displaystyle{\frac{a+b}{2}}$$

Variance: $$\displaystyle{\frac{(b-a)^2}{12}}$$

## Usage¶

Package

Syntax

NumPy

np.uniform(alpha, beta)

SciPy

scipy.stats.uniform(alpha, beta - alpha)

Stan

uniform(alpha, beta)