-
np.random.rand VS np.random.randn
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
-
相关阅读:
HDU 1269 迷宫城堡
HDU 4771 Stealing Harry Potter's Precious
HDU 4772 Zhuge Liang's Password
HDU 1690 Bus System
HDU 2112 HDU Today
HDU 1385 Minimum Transport Cost
HDU 1596 find the safest road
HDU 2680 Choose the best route
HDU 2066 一个人的旅行
AssetBundle管理机制(下)
-
原文地址:https://www.cnblogs.com/larkiisready/p/11681623.html
Copyright © 2020-2023
润新知