Looks OK to me, maybe someone else will chime in as well.
In any case jumpahead(n) should give identical results in both
cpython and pypy if you use a pypy after changeset a2a352a3b535 (in
other words, a nightly from tomorrow onwards)
Matti
On 07/03/15 22:06, Floris van Manen
wrote:
Matti,
On 7 Mar 2015, at 19:37, Matti
Picus <[email protected]>
wrote:
'''
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.
'''
Thanks for pointing out.
I'm using the jumpahead() to have multiple streams
in parallel, derived from a single point.
def
jumpRandomState(self):
self.random.setstate(self.randomState)
self.random.jumpahead(1)
self.randomState = self.random.getstate()
Would this be a good alternative?
def
jumpRandomState(self):
self.random.setstate(self.randomState)
self.random.seed(self.random.random())
self.randomState = self.random.getstate()
.Floris
|
_______________________________________________
pypy-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-dev