2017-04-07 74 views

回答

0

random.sample(人口,K)

Return a k length list of unique elements chosen from the population sequence. Used for random sampling without replacement.

要选择从一个整数范围的样本,使用范围()对象作为参数

>>> import random 
>>> print random.sample(range(1,100),3) 
[77, 29, 45] 
>>> 

https://docs.python.org/2/library/random.html#random.sample

+0

谢谢,明白了 –

2

是样本选择唯一编号

看看 here

+0

谢谢你,有它 –