Another possible way to obtain a discrete distribution similar to the normal distribution is to extract from the multinomial distribution, where the probabilities are calculated from the normal distribution.
import scipy.stats as ss import numpy as np import matplotlib.pyplot as plt x = np.arange(-10, 11) xU, xL = x + 0.5, x - 0.5 prob = ss.norm.cdf(xU, scale = 3) - ss.norm.cdf(xL, scale = 3) prob = prob / prob.sum()
Here np.random.choice selects an integer from [-10, 10]. The probability of choosing an element, say 0, is calculated using p (-0.5 <x <0.5) where x is a normal random variable with an average zero and a standard deviation of 3. I am chooce std. deviation as 3, because in this way p (-10 <x <10) is almost 1.
The result is as follows:

ayhan source share