[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Help-gsl] How many RNG instances?

**From**: |
John D Lamb |

**Subject**: |
Re: [Help-gsl] How many RNG instances? |

**Date**: |
Thu, 06 Jul 2006 17:53:11 +0100 |

**User-agent**: |
Thunderbird 1.5.0.4 (X11/20060527) |

Joe wrote:
>* I have a simple question. Do I need a seperate random number generator*
>* instance for each distribution I use? E.g, I have two different*
>* simulation*
>* parameters, one exponential, the other poisson distributed.*
>
>* Basically, right now, my RNG is wrapped within a singleton class meaning*
>* that I have only one instance, systemwide. Is this a good approach? *
It depends on what you are trying to do. If it did not, then GSL would
not let you have two random number generators at the same time. However,
for most applications, on gsl_rng is enough. If you just want
uncorrelated random variates from a variety of different distributions,
then one gsl_rng will do.
There are some dangers of using two. If (say) you use one gsl_rng for
exponentials and one for uniform variates, use the same type of gsl_rng
with the same seed, and call each generator equally often then while the
sequence of exponential variates will show no little correlation and the
sequence of uniform variates will show little correlation, but the
sequences will be highly correlated with each other. This is usually
undesirable.
--
JDL