np.random.random(3)

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

你可能感兴趣的:(python学习)