This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Dear All,You have to do this only at the beginning of you program
I am planning to do a Monte Carlo simulation using the GSL random number generators. Therefore I would like to ask you something:
I have to simulate a function of one variable. This is a stochastic process. Therefore I have to use the random number generator gsl_ran_gaussian (const gsl_rng * r, double sigma).
Additionally I have to solve certain nonlinear equation which depends on one variable and the nonlinear function is a stochastic process mentioned above. Therefore I have to simulate the value of this functio couple of times.
The question is: Do I have to execute the statement
gsl_rng_env_setup();
T = gsl_rng_default; r = gsl_rng_alloc (T);
each time I compute the value of my function or just once at the beginning of the process where I solve the equation.
My problem is: I want that the random numbers I generate are purelly random and not that the series of the numbers repeats.
On a computer this is impossible but, you can use computer time function to inizialize every time with a different seed.
time_t T; R = gsl_rng_alloc (gsl_rng_mt19937); S = (unsigned) time(&T); gsl_rng_set (R,S);
Thanks a lot for your help,Claudio
Przemyslaw
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |