help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] random number sequence


From: Sergey Mkrtchyan
Subject: Re: [Help-gsl] random number sequence
Date: Tue, 20 May 2008 11:02:22 -0400
User-agent: KMail/1.9.6 (enterprise 20070904.708012)

On Tuesday 20 May 2008 03:35:32 am <address@hidden> wrote:
>
> You mean srand(rand()) ?
> Nice thinking, but I'm afraid this isn't going to solve the problem.
> rand() will always return the same first value, hence srand() will too.
> To change behaviour for different series of random numbers you have to
> change the seed of each program instance, hence feeding it different
> parameters or using microseconds...
>

Oops, yes I meant srand(rand()) as it feels more random :-). To be honest, I 
came to that idea because I have two functions which are using random number 
generator (one is bring_to_equilibrium() and another one is monte_carlo(), 
which are basically the same, with the only difference being that for the 
second one I just calculate and average parameters), So after getting the 
seed from script, I didn't feel like passing the same seed to both of them 
(because then they generated the same sequence, which was probably fine too, 
because after coming to equilibrium system changed anyways...). But then I 
just passed seed of let's say (change_seed + 1) to the other function and 
that seemed to be ok.

> > Thanks you very very much again!

heh, I missed this one too, I meant thank you very much... ;-)

But really, thanks a lot, I'm much happier now.

Sergey






reply via email to

[Prev in Thread] Current Thread [Next in Thread]