#importing the random module from numpy import random #applying the Zipf function res_arr= random.zipf(size=4,a=1.5) #printing the results print('1D array of size 4 having Zipf distribution with distribution parameter 1.5 :\n') print(res_arr)
#importing the random module from numpy import random #here we are using Zipf function to generate Zipf distribution of size 5 x 2 with distribution parameter 2.5 res_arr = random.zipf(size=(5,2),a=2.5) print('2D Zipf Distribution as output from Zipf() function:\n') #printing the result print(res_arr)
#importing the random module from numpy import random #here we are using Zipf function to generate Zipf distribution of size 2 x 3 x 4 res = random.zipf(size=(2,3,4), a=1.1) print('3D Zipf Distribution as output from Zipf() 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 Zipf function to generate distributions of size 3000 with distribution parameter 2 sb.distplot(random.zipf(size=3000,a=2), hist=False, label='Zipf Distribution') #plotting the graph mpl.show()