![](https://secure.gravatar.com/avatar/72f994ca072df3a3d2c3db8a137790fd.jpg?s=120&d=mm&r=g)
Floris is seems you sent the response to only me. The "right" behaviour is to not use jumpahead, which does not work well enough to be part of python 3.1 (note the use of "likely" in the docstring): ''' jumpahead(self, n) method of random.Random instance Change the internal state to one that is likely far away from the current state. This method will not be in Py3.x, so it is better to simply reseed. ''' The implementation changed for python 2.4, in changeset https://hg.python.org/cpython/rev/edd056c4a40d/ as part of the adaptations to the Mersenne Twister generator that replaced WichmannHill in python 2.3 I will try to make pypy return the same values as cpython, but you should consider reseeding for each thread instead Matti On 07/03/15 14:33, Floris van Manen wrote:
On 7 Mar 2015, at 13:28, matti picus <matti.picus@gmail.com <mailto:matti.picus@gmail.com>> wrote:
What did you try that led you to suspect they are different? Matti
yes indeed. Using the jumpahead() fnction will lead to different results. I don't now which are the correct ones...
import random
random.seed(12345) for i in xrange(10): print random.random() print randomState = random.getstate() for i in xrange(10): random.setstate(randomState) random.jumpahead(1) randomState = random.getstate() print random.random()
''' standard python:
0.416619872545 0.0101691694571 0.825206509254 0.2986398552 0.368411689488 0.193661349045 0.566008168729 0.161687823929 0.124266884284 0.43293626801
jumpahead() 0.94861718596 0.466389725591 0.440309106388 0.756595610966 0.329954203719 0.207243180479 0.982769966933 0.856141036147 0.746277878413 0.304000958341
pypy
0.416619872545 0.0101691694571 0.825206509254 0.2986398552 0.368411689488 0.193661349045 0.566008168729 0.161687823929 0.124266884284 0.43293626801
jumpahead() 0.41362858709 0.482594587067 0.363386428038 0.0122210322735 0.218894401377 0.786381037234 0.535611315209 0.545681381301 0.0153701629836 0.136216130724 '''