Just saw this, in-place permutation (of a Java array, in this case).
In Python, if you ignore the battery that's included (random.shuffle) you have this:
import random l = range(0, 20) # array to permute for j in range(1, len(l)): k = random.randint(0, j) l[j], l …read more
There are comments.