[New-bugs-announce] [issue17020] random.random() generating values >= 1.0

Floris van Manen report at bugs.python.org
Wed Jan 23 18:32:12 CET 2013


New submission from Floris van Manen:

I recently noticed that the standard random() function generates values >= 1.0

As processes are called from an event scheduler, each process has its own Random() instance.

    self.random = random.Random(seed)
    self.randomState = self.random.getstate()



keeping track of multiple objects:

    self.random.setstate(self.randomState)
    self.random.jumpahead(1)
    self.randomState = self.random.getstate()


Also gammavariate() generates errors as it too makes use of the _random() call

A workaround is to check each response of random() for values >= 1.0

----------
assignee: ronaldoussoren
components: Macintosh
messages: 180480
nosy: klankschap, ronaldoussoren
priority: normal
severity: normal
status: open
title: random.random() generating values >= 1.0
type: compile error
versions: Python 2.7

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


More information about the New-bugs-announce mailing list