Does shuffle() produce uniform result ?
hniksic at xemacs.org
Fri Aug 24 14:54:14 CEST 2007
tooru honda <tooru_honda at fast-mail.org> writes:
> I have read the source code of the built-in random module,
> random.py. After also reading Wiki article on Knuth Shuffle
> algorithm, I wonder if the shuffle method implemented in random.py
> 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