Random binomial question

Data Analysis Module

I was working with np.random.binomial() function just for fun. I found that when I used parameters 8 at a 40% over 1000 trials I received 0 values for certain numbers. Like this:

made = np.random.binomial(8, .4, 1000)
plt.hist(made)
(array([ 8., 34., 130., 0., 215., 303., 0., 209., 89., 12.]), array([1. , 1.7, 2.4, 3.1, 3.8, 4.5, 5.2, 5.9, 6.6, 7.3, 8. ]), <a list of 10 Patch objects>)

I repeated the process multiple times. Although the 0 changed sometimes, it always was there. How is it possible that on the 4 and 7 attempt there are literally 0 successes? Perhaps I am not looking at it correctly. When I change the 40% to 50% it becomes more evenly distributed. Values appear as you might expect them to. Again at 60% I get the 0’s again.

Because your first parameter is too small.

Samples are drawn from a binomial distribution with specified parameters, n trials and p probability of success where n an integer >= 0 and p is in the interval [0,1].

As you can see, you are drawing 8 samples each time with a probability of 40%. So the probability of not able to draw a value > 0 is 60% ** 8 => ~1.68%.