Python中的 numpy.random.logistic()
借助numpy.random.logistic()方法,我们可以得到逻辑分布的随机样本,并使用该方法返回随机样本。
Syntax : numpy.random.logistic(loc=0.0, scale=1.0, size=None)
Return : Return the random samples as numpy array.
示例 #1:
在这个例子中我们可以看到,通过使用numpy.random.logistic()方法,我们可以得到逻辑分布的随机样本,并使用该方法返回随机样本。
Python3
# import numpy
import numpy as np
import matplotlib.pyplot as plt
# Using numpy.random.logistic() method
gfg1 = np.random.logistic(1.23, 3.14, 1000)
gfg2 = np.random.logistic(gfg1, 3.14, 1000)
count, bins, ignored = plt.hist(gfg2, 50, density = True)
plt.show()
Python3
# import numpy
import numpy as np
import matplotlib.pyplot as plt
# Using numpy.random.logistic() method
gfg = np.random.logistic(13.31, 3.31, 1000)
count, bins, ignored = plt.hist(gfg, 30, density = True)
plt.show()
输出 :
示例 #2:
Python3
# import numpy
import numpy as np
import matplotlib.pyplot as plt
# Using numpy.random.logistic() method
gfg = np.random.logistic(13.31, 3.31, 1000)
count, bins, ignored = plt.hist(gfg, 30, density = True)
plt.show()
输出 :