Does shuffle() produce uniform result ?

Hrvoje Niksic hniksic at
Fri Aug 24 14:54:14 CEST 2007

tooru honda <tooru_honda at> writes:

> 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 bias.

It doesn't have modulo bias because it doesn't use modulo to produce a
random index; it multiplies the floating point value with the desired
range.  I'm not sure if that method produces any measurable bias.

More information about the Python-list mailing list