Mark Dickinson <dicki...@gmail.com> added the comment: Here's an example patch that removes any bias from randrange(n) (except for bias resulting from the imperfectness of the core MT generator). I added a small private method to Modules/_randommodule.c to aid the computation.
This only fixes one instance of int(random() * n) in the Lib/random.py source; the other instances should be modified accordingly. With this patch, randrange is a touch faster than before (20-30% speedup) for small arguments. Is this worth pursuing? ---------- keywords: +patch Added file: http://bugs.python.org/file17706/issue9025.patch _______________________________________ 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