jeudi 22 novembre 2018

How can Python randomly shuffle a list of 100,000 items?

I'm trying to perform some statistical analysis on long sequences of numbers. That requires a randomised shuffle of the list. The tests are sensitive, so fairness and randomness is very important. The list is 100,000 integers, but I would like to try 1 million.

Bearing in mind that Maximal Length of List to Shuffle with Python random.shuffle? says the maximum length is 2080 items, how can I properly shuffle such a long list using Python?


NB.

  • Fairness trumps efficiency or speed.

  • I have access to /dev/urandom.

  • The USA's NIST laboratory does it using C++ within their entropy measurement suite, SP800-90B, EntropyAssessment. They sort sequences of 1 million bytes. It's @ https://github.com/usnistgov/SP800-90B_EntropyAssessment.




Aucun commentaire:

Enregistrer un commentaire