
On 2012-12-24 18:20:06 +0100, Brian Budge said:
On Thu, Dec 20, 2012 at 8:26 AM, Philipp Kraus
If possible, can you construct an object per thread?
I don't know, because I call the Boost random calls from a Lua script and initialize the boost random object with a static member globally over all threads (and MPI cores).
This is typically the way that I have used these wrappers (and actually the reason for writing them). If you need a specific sequence, it might make sense to generate many random numbers up-front, and then use them in the thread. If all else fails, you can use your own boost::mutex and boost::lock_guard to ensure thread safety.
At the moment I think a own object on each thread is a good choice, but I must change same design structures, so a mutex is a faster way to solve it Phil