Boost logo

Boost :

Subject: Re: [boost] [random] new threefry random engine
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2014-04-27 10:24:38


On 27/04/14 14:58, Thijs (M.A.) van den Berg wrote:

> You would still need to split the range [0,n) into non-overlapping subsets per thread.

That's what the parallelization of the algorithm does.
(In the case in the previous mail, it's done automatically by OpenMP)

> You will need some unique id per thread -either a thread id, or some static counter that threads use when they are initialized- to do that. That unique id can also be used to seed regular random engines, so that is to me not a big addition.

That would defeat the point IMO.

I want to be able to write parallel code involving random number
generation where the result does not depend at all of how the code is
parallelized.

Counter-based random number generators can compute the i-th random
number in O(1) instead of the classical O(n).
That means that for a given generator with a given seed, I can compute
the i-th random number and the j-th random number in parallel. That's
what I want to do. I don't want per-thread seeds.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk