rand(3f) rand(3f)
Name
rand, drand, irand - generates random numbers
Syntax
**integer irand, i, ***iflag*
**real rand, x**
**double precision drand, d**
**external rand, drand, irand**
**...**
**i = irand **( *iflag *)
**x = rand **( *iflag *)
**d = drand **( *iflag *)
Description
The **rand **and **drand **functions generate pseudo-random numbers distributed
in [0, 1.0].
The **irand **function generates successive pseudo-random integers in the
range from 0 to RAND_MAX (generally 2**15-1 for integer*4).
If *iflag *is '0', the generator returns the next random number in the
sequence.
If *iflag *is '1', the generator is restarted and the first random value is
returned.
If *iflag *is otherwise non-zero, it is used as a new seed for the random
number generator, and the first new random value is returned.
Files
libU77.a
See Also
rand(3), random(3)
Notes
This impilmentation of **rand **is compatable with that provided with the
SunOS and BSD UNIX Fortran 77 compilers. Other compilers do things
differently, with a seperate call to seed the random number generator (I
prefer the latter approach, but for no good reason I have gone the BSD
way).
Anyone who wants real pseudo-random numbers and real performance will
want to write their own code. Try reading knuth.
rand(3f)