[New-bugs-announce] [issue7889] random produces different output on different architectures

Terrence Cole report at bugs.python.org
Tue Feb 9 01:15:53 CET 2010


New submission from Terrence Cole <terrence at zettabytestorage.com>:

This code:
>>> random.seed(b'foo')
>>> random.getrandbits(8)
...repeated 7 more times...

Yields the sequence of values:
amd64: 227, 199,  34, 218,  83, 115, 236, 254
x86:   245, 198, 204,  66, 219,   4, 168,  93

Comments in the source seem to indicate random should produce the same results on all platforms.

I first thought that the seed was not resetting the state correctly, however, if I do a 'random.setstate( (3,(0,)*625,None) )' before seeding the generator, the results do not change from what is given above.  Also, calls to getrandbits after the setstate, but before another seed, correctly return 0.  It seems from this that seed is resetting the state properly, but some of the internals are not 32bit/64bit consistent.

----------
components: Library (Lib)
messages: 99078
nosy: terrence
severity: normal
status: open
title: random produces different output on different architectures
type: behavior
versions: Python 3.1

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


More information about the New-bugs-announce mailing list