[issue9025] Non-uniformity in randrange for large arguments.

Mark Dickinson report at bugs.python.org
Thu Jun 24 11:33:41 CEST 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

A couple of points:

(1) In addition to documenting the extent of the repeatability, it would be good to have tests to prevent changes that inadvertently change the sequence of randrange values.

(2) For large arguments, cross-platform reproducibility is already a bit fragile.  For example, the _randbelow function depends on the system _log function---see the line

    k = int(1.00001 + _log(n-1, 2.0))

Now that we have the bit_length method available, it might be better to use that.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9025>
_______________________________________


More information about the Python-bugs-list mailing list