import random SEED = 448 myList = [ 'list', 'elements', 'go', 'here' ] random.seed(SEED) random.shuffle(myList) print myList
leads to
['here', 'go', 'list', 'elements']
Your list is now pseudo-authorized.
Pseudo is important because all lists that have the same seed and number of items are returned in the same "random" order. We can use this to not shuffle your list; if it were truly random, it would be impossible.
Order = list(range(len(myList)))
leads to
['list', 'elements', 'go', 'here']
TA-dah! originalList is now the initial order of myList.
Hugh bothwell
source share