Binomial Distribution describes the outcome of binary scenarios, e.g. toss of a coin, it will either be head or tails.
Binomial Distribution is a Discrete Distribution.
binomial() method in NumPy Python has three parameters:
n – number of trials.
p – probability of occurence of each trial (e.g. for toss of a coin 0.5 each).
size – The shape of the returned array.
Example-
from numpy import random
import matplotlib.pyplot as plt
import seaborn as sns
sns.displot(random.binomial(n=10, p=0.5, size=100))
plt.show()
Output-
Leave a Reply