numpy performance and random numbers

Gregory Ewing greg.ewing at canterbury.ac.nz
Sat Dec 19 19:04:10 EST 2009


Lie Ryan wrote:

> If you don't care about "repeatability" (which is already extremely 
> difficult in parallel processing even without random number generators), 
> you can just start two PRNG at two distinct states (and probably from 
> two different algorithms)

There's no need for different algorithms, and no problem
with repeatability. There exist algorithms with a very
long period (on the order of 2*100 or more) for which it's
easy to calculate seeds for a set of guaranteed non-
overlapping subsequences.

http://or.journal.informs.org/cgi/content/abstract/44/5/816
http://or.journal.informs.org/cgi/content/abstract/47/1/159

In these kinds of generator, moving from one state to
the next involves multiplying a state vector by a matrix
using modulo arithmetic. So you can jump ahead N steps
by raising the matrix to the power of N.

-- 
Greg



More information about the Python-list mailing list