Binomial Distribution is a discrete distribution that describes the outcomes of binary scenarios, such as a coin toss, which can result in either heads or tails.
It has three parameters:
| Discrete Distribution is defined at distinct events; for instance, the outcome of a coin toss is discrete because it can only result in heads or tails, whereas a person’s height is continuous, as it can take on values like 170, 170.1, 170.11, and so forth. |
Generate 10 data points based on 10 trials of a coin toss:
| from numpy import random x = random.binomial(n=10, p=0.5, size=10) print(x) |
| from numpy import random import matplotlib.pyplot as plt import seaborn as sns sns.distplot(random.binomial(n=10, p=0.5, size=1000), hist=True, kde=False) plt.show() |

The primary difference is that the normal distribution is continuous, while the binomial distribution is discrete; however, with a sufficient number of data points, the binomial distribution will resemble the normal distribution with specific values for loc and scale.
| from numpy import random import matplotlib.pyplot as plt import seaborn as sns sns.distplot(random.normal(loc=50, scale=5, size=1000), hist=False, label=‘normal’) sns.distplot(random.binomial(n=100, p=0.5, size=1000), hist=False, label=‘binomial’) plt.show() |
