This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]