def __init__(self, n):
m = list(range(n))<EOL>for end in xrange(n - <NUM_LIT:1>, <NUM_LIT:0>, -<NUM_LIT:1>):<EOL><INDENT>r = random.randint(<NUM_LIT:0>, end)<EOL>tmp = m[end]<EOL>m[end] = m[r]<EOL>m[r] = tmp<EOL><DEDENT>self.mapping = m<EOL>
Init a Permute object. Randomly generate a mapping, e.g. [0,1,2] -> [1,0,2]