def permutate(list): n = len(list) for i in xrange(n): rnd = randint(0, n-i-1) swap(list, rnd, i)
def sort(list): while not isSorted(list): i1, i2 = randomIndexes(len(list) - 1) swap(list, i1, i2) return list