# Multiple instances of random generator

I wonder whether following methodology is correct.

I need to introduce concurrent processing to my simulating application.I want to use Mersenne Twister random generator. I wonder whether I can create a few instances of this generator (initialized with different seed, base on time of creation) and use them in separated threads. The problem is whether there will be no connection between values I get from multiple instances of random generators initialized with different seeds.

Do you have any experience with it / advices ?

(I know that this question might be asked in stackoverflow however I think that is a little bit more mathematical problem).

-

## 1 Answer

It depends on how many random draws you're likely to make from the generator, how many threads you will be running and how long the cycle length of the generator is.

The main problem with parallel Monte Carlo comes from overlap of random sequences initialized with different seeds.

As a very rough approximation, if the cycle length is $N$ and you are running $q$ threads, each of which makes $n$ draws, then you are effectively choosing $p$ objects from among $p=N/n$. Therefore the probability that none of your sequences overlap is roughly

$$f(N,n,p) = \frac{p(p-1)\cdots(p-q+1)}{p^q} = \frac{p!}{(p-q)! p^q}$$

As long as this number is significantly less than 1, you should be fine.

-