Does shuffle() produce uniform result ?

Raymond Hettinger python at rcn.com
Tue Sep 4 21:39:50 EDT 2007


On Aug 24, 12:38 am, tooru honda <tooru_ho... at fast-mail.org> wrote:
> 1. Does shuffle() produce uniform result ?

If you're worried about this microscopic bias (on the order of
2**-53), then shuffle more than once.  That will distribute the bias
more evenly:

  def super_shuffle(sequence):
      for i in range(10):
           shuffle(sequence)


Raymond Hettinger







More information about the Python-list mailing list