I have a list a=[num1,num2,...,numn]
. I am shuffling it with random.shuffle(a)
. However what I want as a functionality is the shuffle algorithm to take as input a key, and the owner of the key to deterministically produce the same shuffles?
I want an algorithm that takes as input the key, the sequence of elements to be shuffled and it outputs a random permutation thereof, depending on the key. If you apply the shuffle again with input the same key on the same sequence of data you are getting the same result. Otherwise random shuffle. The same key on the same data allows to "un-shuffle"
Is that possible?