from numpy import random #here we are using binomial function to generate binomial distribution of size 3 x 5 res = random.binomial(size=(3,5), n=3, p=0.5) print('2D Binomial Distribution as output from binomial() function:\n') #printing the result print(res)
from numpy import random #here we are using binomial function to generate binomial distribution of size 4 x 2 x 8 res = random.binomial (size=(4,2,8), n=80, p=0.2) print('3D binomial Distribution as output from binomial() function:\n') #printing the result print(res)
#importing all the required modules and packages from numpy import random import matplotlib.pyplot as mpl import seaborn as sb #here we are using binomial function to generate binomial distribution of size 100 sb.distplot(random.binomial(size=1000, n = 10, p = 0.1), hist=True, kde=False) #plotting the graph mpl.show()