Next: , Previous: Radix Intrinsic, Up: Table of Intrinsic Functions


8.11.9.207 Rand Intrinsic

     Rand(Flag)

Rand: REAL(KIND=1) function.

Flag: INTEGER; OPTIONAL; scalar; INTENT(IN).

Intrinsic groups: unix.

Description:

Returns a uniform quasi-random number between 0 and 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 SRand Intrinsic.

Note: As typically implemented (by the routine of the same name in the C library), this random number generator is a very poor one, though the BSD and GNU libraries provide a much better implementation than the `traditional' one. On a different system you almost certainly want to use something better.