This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GNU Fortran inquiry
- From: "S. Bosscher" <S dot Bosscher at student dot tudelft dot nl>
- To: "'descamps at ensm-douai dot fr'" <descamps at ensm-douai dot fr>
- Cc: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Tue, 27 Nov 2001 21:21:51 +0100
- Subject: Re: GNU Fortran inquiry
> That way, the sequence
>
> Call srand(seed_value)
>
> do j= 1,10
> Write(*,*) rand()
> enddo
>
> will give you ten "random numbers" for the seed seed_value.
The RAND function is defined as RAND(Flag), and it returns a pseudo-random
number in <0,1>. If Flag is 0, the next number in sequence is returned; if
Flag is 1, the generator is restarted by calling `srand(0)'; if Flag has any
other value, it is used as a new seed with srand.
See the GNU Fortran manual for details:
http://gcc.gnu.org/onlinedocs/g77_12.html#SEC314
Both the RAND and SRAND intrinsics are described in this manual.
Greetz
Steven