According to the http://ift.tt/1Dult80, using the replace = False
with Numpy's random.choice
method should make the sample without replacement. However, this does not seem to work for me:
In [33]: import numpy as np
In [34]: arr = range(5)
In [35]: number = np.random.choice(arr, replace = False)
In [36]: arr
Out[36]: [0, 1, 2, 3, 4]
The array arr
is still range(5)
after sampling, and not missing a (random) number as I would expect. How could I sample a number from range(5)
without replacement?
Aucun commentaire:
Enregistrer un commentaire