2017-04-07 29 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

謝謝你,有它 –