为什么 Python 中的 "np.random.rand()" 函数只输出小于 1 的浮点值?
Why "np.random.rand()" function in Python outputs only float values below 1?
输入:
>>> np.random.rand(2,3)
输出:
array([[0.81967966, 0.24861747, 0.1324781 ],
[0.10917913, 0.61025551, 0.87901984]])
答案在docs
Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1).
输入:
>>> np.random.rand(2,3)
输出:
array([[0.81967966, 0.24861747, 0.1324781 ],
[0.10917913, 0.61025551, 0.87901984]])
答案在docs
Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1).