Re: random module question

2005-06-07 Thread Raymond Hettinger
>> Is Mersenne Twister currently available at all in Jython, for example?

Googling for "java mersenne twister" provides multiple hits including:

http://www.axlradius.com/freestuff/Free.htm#MT


Raymond

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: random module question

2005-06-06 Thread Roose
Raymond Hettinger wrote:
> The answer is a qualified Yes.  While the core generator (currently

Thanks!  That is the answer I'm looking for.

And to Paul Rubin, it is a good point that Jython might not support it, but 
at this point it doesn't interest me.  The program is only for myself 
anyway.

R


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: random module question

2005-06-06 Thread Paul Rubin
"Raymond Hettinger" <[EMAIL PROTECTED]> writes:
> >> Can I rely on the random.py module to produce the same series of
> >> numbers for future/past versions of Python, given the same seed?
> 
> The answer is a qualified Yes.  While the core generator (currently the
> Mersenne Twister algorithm) is subject to change across versions,
> whenever we've updated the generator, a backward compatable version is
> offered (random.WichmannHill for example). 

Is Mersenne Twister currently available at all in Jython, for example?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: random module question

2005-06-06 Thread Raymond Hettinger
>> Can I rely on the random.py module to produce the same series of
>> numbers for future/past versions of Python, given the same seed?

The answer is a qualified Yes.  While the core generator (currently the
Mersenne Twister algorithm) is subject to change across versions,
whenever we've updated the generator, a backward compatable version is
offered (random.WichmannHill for example).  So, it should always be
possible to recreate a series but you may have to change the calling
code to point to the correct generator.



>> Can I rely on it across different architectures and operating systems?

The current Mersenne Twister algorithm is guaranteed to produce the
same results across different architectures and operating systems.
That is evident from the test suite which verifies a bit-by-bit match
to a target test sequence (the test is expected to pass on all C boxes
with at least 53 bit floating point precision).

Of course, none of the above applies to random.SystemRandom which
accesses system generated entropy sources.



Raymond Hettinger

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: random module question

2005-06-05 Thread Paul Rubin
"Roose" <[EMAIL PROTECTED]> writes:
> Can I rely on the random.py module to produce the same series of numbers for 
> future/past versions of Python, given the same seed?  Can I rely on it 
> across different architectures and operating systems?
> 
> I looked at the docs and couldn't find this stated anywhere.  My feeling is 
> yes, but it's a fairly big claim so I want to make sure.

I do not think you should rely on this.  It uses a very specific
algorithm (Mersenne Twister) which is written in C and is nonstandard,
and future Python implementers shouldn't be expected to implement the
exact same algorithm.  It's probably already unavailable in Jython.

See SF bug 917055 for some further discussion.
-- 
http://mail.python.org/mailman/listinfo/python-list


random module question

2005-06-05 Thread Roose
Can I rely on the random.py module to produce the same series of numbers for 
future/past versions of Python, given the same seed?  Can I rely on it 
across different architectures and operating systems?

I looked at the docs and couldn't find this stated anywhere.  My feeling is 
yes, but it's a fairly big claim so I want to make sure.

R 


-- 
http://mail.python.org/mailman/listinfo/python-list