Mark Dickinson <dicki...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue9025> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com