numpy performance and random numbers
Lie Ryan
lie.1296 at gmail.com
Sun Dec 20 04:47:39 EST 2009
On 12/20/2009 2:53 PM, sturlamolden wrote:
> On 20 Des, 01:46, Lie Ryan<lie.1... at gmail.com> wrote:
>
>> Not necessarily, you only need to be certain that the two streams don't
>> overlap in any reasonable amount of time. For that purpose, you can use
>> a PRNG that have extremely high period like Mersenne Twister and puts
>> the generators to very distant states.
>
> Except there is no way to find two very distant states and prove they
> are distant enough.
>
Except only theoretical scientist feel the need to prove it and perhaps
perhaps for cryptographic-level security. Random number for games,
random number for tmp files, and 99.99% random number users doesn't
really need such proves.
And don't forget the effect of the very long period of PRNG like
Mersenne Twister (2**19937 − 1, according to Wikipedia) makes it very
unlikely to choose two different seeds and ended up in nearby entry
point. Let's just assume we're using a 2**64-bit integer as the seeds
and let's assume the entry point defined by these seeds are uniformly
distributed you would to generate (on average) 2.34E+5982 numbers before
you clashes with the nearest entry point. Such amount of numbers would
require decades to generate. Your seed generator guard would only need
to prevent seeding parallel generators with the same seed (which is
disastrous), and that's it, the big period covers everything else.
More information about the Python-list
mailing list