在python中使用random.random生成随机样本 - python

我想使用random.random函数生成一个介于0和1之间的100个随机数的样本大小。

import random
sample = [random.random for x in range(100)]

例如,while print(len(sample))给我100,print(sample[1])仅返回对random object()的引用,而不是我想要的实际随机数。

为什么这对我不起作用?

可能是基本的,但我找不到答案。

python大神给出的解决方案

您没有在调用该方法:

[random.random() for x in range(100)]
              ^^