The sample space for a discrete uniform distribution is the set of integers from \(a\) to \(b\), i.e., its parameters are \(a\) and \(b\). We denote it by \(\mathrm{Unif}(a,b)\). All elements of the sample space have equal probability. Since there are \(b-a+1\) elements in the sample space, the PMF for a discrete uniform distribution is

\[p_X(x)=\dfrac{1}{b-a+1}.\]

Expectation

The mean of a discrete uniform random variable is

\[\mathbb{E}[X]=\frac{a+b}{2}.\]

Variance

The variance of a discrete uniform random variable is

\[\mathrm{var}(X)=\tfrac{1}{12}(b-a)(b-a+2).\]