Hi!
The standard algorithm for sampling without replacement is ``O(N)`` expected
for ``N < 0.5 * M`` where ``M`` is the length of the original set, but
``O(N^2)`` worst-case. When this is not true, a simple Durstenfeld-Fisher-Yates
shuffle [1] (``O(M)``) can be used on the original set and then
Hi,
I noticed that numpy.random.choice was very slow, with the
replace=False option, and then I noticed it can (for most cases) be
made many hundreds of times faster in Python code:
In [18]: sample = np.random.uniform(size=100)
In [19]: timeit np.random.choice(sample, 500, replace=False)