// Generate a few more values than k so that we can get unique values
// afterwards.
// XXX: one could be smarter here
mlow = 5
fac = 1.02
gk = min(k + mlow, fac * k)
if random_state is None:
random_state = np.random
elif isinstance(random_state, (int, np.integer)):
After Change
ind = random_state.permutation(mn)[:k]
else:
ind = np.empty(k, dtype=tp)
selected = set()
for i in xrange(k):
j = random_state.randint(mn)
while j in selected:
j = random_state.randint(mn)