lundi 7 décembre 2015

How to randomly shuffle a list that has more permutations than the PRNG's period?

I have a list with around 3900 elements that I need to produce random permutations of to produce a statistical distribution. I looked around and found this Maximal Length of List to Shuffle with Python random.shuffle that explained that the period of the PRNG in Python is 2**19937-1, which leads to a list with a maximum length of 2080 before it becomes impossible to generate all possible permutations. I am only producing 300-1000 permutations of the list so it unlikely that I will be producing duplicate permutations, however, since this is a for producing a statistical distribution I would like to have all possible permutations as potential samples.




Aucun commentaire:

Enregistrer un commentaire