离散均匀(randint)分布#

具有参数 \(\left(a,b\right)\) 的离散均匀分布构造了一个随机变量,该变量在半开区间 \([a,b)\) 内的任意一个整数上具有相等的概率。如果未给出 \(a\),则假定为零,唯一的参数是 \(b\)。因此,

\begin{eqnarray*} p\left(k,a,b\right) & = & \frac{1}{b-a} \quad a \leq k < b \\ F\left(x;a,b\right) & = & \frac{\left\lfloor x\right\rfloor -a}{b-a} \quad a \leq x \leq b \\ G\left(q;a,b\right) & = & \left\lceil q\left(b-a\right)+a\right\rceil \\ \mu & = & \frac{b+a-1}{2}\\ \mu_{2} & = & \frac{\left(b-a-1\right)\left(b-a+1\right)}{12}\\ \gamma_{1} & = & 0 \\ \gamma_{2} & = & -\frac{6}{5}\frac{\left(b-a\right)^{2}+1}{\left(b-a-1\right)\left(b-a+1\right)}. \end{eqnarray*}
\begin{eqnarray*} M\left(t\right) & = & \frac{1}{b-a}\sum_{k=a}^{b-1}e^{tk}\\ & = & \frac{e^{bt}-e^{at}}{\left(b-a\right)\left(e^{t}-1\right)} \end{eqnarray*}

实现:scipy.stats.randint