Does shuffle() produce uniform result ?

tooru honda tooru_honda at
Fri Aug 24 09:38:51 CEST 2007


I have read the source code of the built-in random module,  
After also reading Wiki article on Knuth Shuffle algorithm, I wonder if 
the shuffle method implemented in produces results with modulo 

The reasoning is as follows: Because the method random() only produces 
finitely many possible results, we get modulo bias when the number of 
possible results is not divisible by the size of the shuffled list.

1. Does shuffle() produce uniform result ?

2. If not, is there a fast and uniform shuffle() available somewhere ?

Thanks !

-tooru honda

More information about the Python-list mailing list