Next: ITIME, Previous: IDATE, Up: Intrinsic Procedures
IRAND — Integer pseudo-random numberIRAND(FLAG) returns a pseudo-random number from a uniform
distribution between 0 and a system-dependent limit (which is in most
cases 2147483647). If FLAG is 0, the next number
in the current sequence is returned; if FLAG is 1, the generator
is restarted by CALL SRAND(0); if FLAG has any other value,
it is used as a new seed with SRAND.
I = IRAND(FLAG)
| FLAG | shall be a scalar INTEGER of kind 4.
|
INTEGER(kind=4) type.
program test_irand
integer,parameter :: seed = 86456
call srand(seed)
print *, irand(), irand(), irand(), irand()
print *, irand(seed), irand(), irand(), irand()
end program test_irand