5 ms·
That probably works too, but it's even more awkard than the Knuth's one, and doesn't have the nice properties I mentioned. I meant just: for i in range(1,
by jwilk 4y ago
That probably works too, but it's even more awkard than the Knuth's one, and doesn't have the nice properties I mentioned.
I meant just:
for i in range(1, len(x)):
r = randrange(i + 1)
x[i], x[r] = x[r], x[i]