A terminal asks for PIN code and each time shows numbers in different order. Like: https://support.lockself.com/hc/en-us/articles/4411709685010-Change-your-PIN-code Or when a website asks for CVV2. This is random permutation. Can be done using random.shuffle() https://docs.python.org/3/library/random.html = >>> import random >>> x=list(range(10)) >>> random.shuffle(x) >>> print (x) [7, 9, 0, 5, 2, 1, 8, 3, 6, 4] = Or: = 7, 9, 0, 5, 2, 1, 8, 3, 6, 4 = Inside random.shuffle() function: = def shuffle(self, x): """Shuffle list x in place, and return None.""" randbelow = self._randbelow for i in reversed(range(1, len(x))): # pick an element in x[:i+1] with which to exchange x[i] j = randbelow(i + 1) x[i], x[j] = x[j], x[i] = If you don't have such function, just swap values from a random pair. Also, all random permutations of numbers in 0..9 range can be precalculated and cached: = #!/usr/bin/env python3 import itertools, random # to be cached list_of_all_permutations=list(itertools.permutations(range(10))) print (random.choice(list_of_all_permutations)) = Random permutation can be obtained if to generate a random number and convert it to permutation using Lehmer coding.