On Wed, Sep 04, 2019 at 03:09:26PM +0300, Janne Blomqvist wrote: > Currently, when a new thread needs to use the RANDOM_NUMBER intrinsic, > the per-thread PRNG state is initialized by copying the master state > and then jumping forwards N*2**128 entries in the stream so that the > PRNG streams for different threads don't alias each other, where N is > the number of threads that have so far initialized the PRNG. > > With this patch the master state itself is jumped forwards once each > time a new thread initializes the PRNG, thus obviating the need to > jump through all the N-1 previous streams. Effectively turning an O(N) > algorithm into an O(1) one. > > Regtested on x86_64-pc-linux-gnu, Ok for trunk? >
Ok. -- Steve