[issue14591] Value returned by random.random() out of valid range

Dave Reid report at bugs.python.org
Mon Apr 16 11:09:52 CEST 2012


New submission from Dave Reid <seabass666 at gmail.com>:

A particular combination of seed and jumpahead calls seems to force the MT generator into a state where it produces a random variate that is outside the range 0-1. Problem looks like it might be in _randommodule.c:genrand_int32, which produces a value > 0xffffffff for the given state, but I don't understand the generator well enough to debug any further.

The attached test case produces 1.58809998297 as the 2nd variate in Python 2.7 and 1.35540900431 as the 23rd variate in Python 2.7.3. The problem occurs on both Linux (CentOS 6) and Mac OSX (10.6.8), both 64-bit.

----------
components: Interpreter Core
files: badrand.py
messages: 158406
nosy: Dave.Reid
priority: normal
severity: normal
status: open
title: Value returned by random.random() out of valid range
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file25235/badrand.py

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


More information about the Python-bugs-list mailing list