# Custom made discrete distribution: from scipy import stats xk = np.arange(7) pk = (0.1, 0.2, 0.3, 0.1, 0.1, 0.0, 0.2) custm = stats.rv_discrete(name='custm', values=(xk, pk)) # >>> import matplotlib.pyplot as plt fig, ax = plt.subplots(1, 1) ax.plot(xk, custm.pmf(xk), 'ro', ms=12, mec='r') ax.vlines(xk, 0, custm.pmf(xk), colors='r', lw=4) plt.show() # Random number generation: R = custm.rvs(size=100)