1. 程式人生 > >np.random.random(3)

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  ])