how to generate uncorrelated random numbers in repeated calls in parallel?

Posted by user1446948 on Stack Overflow See other posts from Stack Overflow or by user1446948
Published on 2012-06-10T04:36:03Z Indexed on 2012/06/10 4:40 UTC
Read the original article Hit count: 94

Filed under:
|
|

I want to write a function which will be repeatedly called by other functions many times. Inside this function it is supposed to generate a lot of random numbers and this part will be treated in parallel. If only for one run, the seed can be chosen differently for each thread, so that the random numbers will be uncorrelated. However, if this function will be called the 2nd time, it seems that the random numbers will repeat unless the seed will be again changed during the later calls.

So my question is, is there a good way to generate the random numbers or reset the seed so that the random numbers generated by repeated calls to this function and also by different threads are really random?

Thank you.

© Stack Overflow or respective owner

Related posts about c

    Related posts about random