This is the mail archive of the
mailing list for the GCC project.
RE: GNU Fortran inquiry
- From: pete at ltoi dot iap dot physik dot tu-darmstadt dot de
- To: descamps at ensm-douai dot fr
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 27 Nov 2001 20:10:14 +0200 (MEST)
- Subject: RE: GNU Fortran inquiry
> I must use a random generator.
> So, I use the following intrinsic function : rand(seed).
> Netherveless, a given seed always produces the same sequence of
> values from rand.
Assumed i don't missunderstand you repective your english wording:
According to my understandig how the Unix Fortran (i.e. Non
standard Fortran-77) intrinsic "rand" works, you had to call the
seed initialisation routine "srand" with the seed value. Then
succsessive calls of "rand" will give you a sequence of pseudo random
numbers for this seed.
That way, the sequence
do j= 1,10
will give you ten "random numbers" for the seed seed_value.
Of course, the sequences will be identical if you use the same
seed_value. That the way the things are (and should be) wired.
Otherwise you have no change to reproduce your simulation, for
debugging purpose of the program, for example.
> I would like to know if it is possible to use a constant to seed
> with the current time.
Yes, but Tex motto applies: User had to work it out. But i doubt,
you mean it this way.
If you had to use "much" random numbers, you had to check, if
the periodicity intervall of the pseudo random number generator
used, is sufficient for this.
Hope that i don't had missinterpret your question!