help-gsl
[Top][All Lists]
Advanced

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

[Help-gsl] random number sequence


From: Sergey Mkrtchyan
Subject: [Help-gsl] random number sequence
Date: Mon, 19 May 2008 16:58:08 -0400

Hi List,

I've bumped into really weird problem.

I have a piece of code which looks like...
___________________________________________
...

        const gsl_rng_type *T;
        gsl_rng *r;

        srand(time(NULL));

        gsl_rng_default_seed = rand()/(((double)RAND_MAX + 1)/10000000);

        T = gsl_rng_default;
        r = gsl_rng_alloc(T);

...

for(steps = 1; steps <= number_of_eq_steps; steps++){
                
                        rand_monomer_number = 1 + gsl_rng_uniform_int(r, N);

                        printf("random number = %lu\n", rand_monomer_number);
...
___________________________________

It works perfectly, but the problem is, that if I ran the program very
quickly one after another(or if two separate instances start at the
same time) it gives me the same sequence of random numbers, but if I
delay running the same thing for very little it gives different
sequences.

I have to do some averaging, and I submit the same job on the cluster
1000 times, and usually they start running group by group so I end up
having the same results for every 10 or so jobs.

Any help is highly appreciated, I'm kind of stuck with this and
nothing comes to my mind.

Regards,
Sergey




reply via email to

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