np.random.rand()
Create an array of the given shape and populate it with random samples from a uniform distribution (均匀分布) over [0, 1).
Example:
>>> np.random.rand(3,2)
array([[ 0.14022471, 0.96360618], #random
[ 0.37601032, 0.25528411], #random
[ 0.49313049, 0.94909878]]) #random
np.random.randn()
Return a sample (or samples) from the “standard normal” distribution(标准正态分布).
Notes
For random samples from N(\mu, \sigma^2), use:
>>> sigma * np.random.randn(…) + mu
Example:
>>> np.random.randn()
2.1923875335537315 #random
Two-by-four array of samples from N(3, 6.25):
>>> 2.5 * np.random.randn(2, 4) + 3
array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random
[ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random
posted @
2019-09-17 14:25
larkii
阅读(
216)
评论()
编辑
收藏
举报