均值、方差(0,1)的高斯函数曲线
def plot_():
mu, sigma = 0, 1
print(sigma)
# s = np.random.normal(loc=mu, scale=sigma, size=1000)
X = np.arange(0,20,0.001)-10
ss = 1. / (np.sqrt(2 * np.pi) * sigma)* np.exp(-(X - mu) ** 2 / (2 * sigma ** 2))
ss_max = np.max(ss)
print("最大值:",ss_max)
plt.plot(X,ss)
plt.vlines(0, 0, ss_max, colors='r', linestyles='solid', label='', data=None,)
plt.show()
plot_()
随机生成0-1之间的数
np.random.seed(666)
s = np.random.random((2,3)) or s = np.random.random( size =(2,3))
s = np.random.random(10) or s = np.random.random(size = 10)