[issue9025] Non-uniformity in randrange for large arguments.
Mark Dickinson
report at bugs.python.org
Wed Jun 23 10:41:55 CEST 2010
Mark Dickinson <dickinsm at gmail.com> added the comment:
Either of these looks good to me.
If the last line of the second is changed from "return int(r) % n" to "return int(r) // (N // n)" then it'll use the high-order bits of random() instead of the low-order bits. This doesn't matter for MT, but might matter for subclasses of Random using a different underlying generator.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9025>
_______________________________________
More information about the Python-bugs-list
mailing list