np.random.random(3)

>>> import random
>>> random.random(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: random() takes no arguments (1 given)
>>> random.random()
0.3323491446054938
>>> random.random(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: random() takes no arguments (1 given)
>>> import numpy as np
>>> np.random.random(3)
array([0.85786582, 0.39180011, 0.109845  ])

猜你喜欢

转载自blog.csdn.net/HIsckey/article/details/84340511