I need to draw random integers from a truncated discrete Gaussian distribution. That is, the probability of integer $i$ is:
$$p_i \propto \exp\left( -\frac{(i-\mu)^2}{2\sigma^2} \right)$$
for $a \le i \le b$, and $p_i = 0$ otherwise. The missing proportionality constant is obtained from the normalization condition, $\sum_i p_i = 1$. Here $\mu$ and $\sigma$ are real parameters.
Is there a way (package, algorithm, trick, anything) to sample this distribution?