[issue1704] possible bug in randint

Raymond Hettinger report at bugs.python.org
Sat Dec 29 17:56:41 CET 2007


Raymond Hettinger added the comment:

Attaching the whole file isn't a step in the right direction.  The 
preferred approach is to isolate the problem as tightly as possible.

This report is dubious because, I can't get the following to fail:

from random import seed, randint
seed('mystart')
while 1:
   assert 0 <= randint(0, 1452) <= 1452

There is also no failure with:

preshuffle = [None] * 1453
while 1:
   assert 0 <= randint(0, len(preshuffle)-1) <= 1452

Make sure that PWRand.randint() really does call randint() and not 
randrange() and that it doesn't adjust the range of inputs.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1704>
__________________________________


More information about the Python-bugs-list mailing list