Portability Functions: Return random numbers in the range 0 through (2**31)-1, or 0 through (2**15)-1 if called without an argument.
Module: USE DFPORT
Syntax
Results:
The result is of type INTEGER(4). If iflag is 1, the generator is restarted and the first random value is returned. If iflag is 0, the next random number in the sequence is returned. If iflag is neither zero nor 1, it is used as a new seed for the random number generator, and the functions return the first new random value.
IRAND and IRANDM are equivalent and return the same random numbers. Both functions are included to ensure portability of existing code that references one or both of them.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also: RANDOM_NUMBER, RANDOM_SEED, Portability Library
Example
USE DFPORT
INTEGER(4) istat, flag_value, r_nums(20)
flag_value=1
r_nums(1) = IRAND (flag_value)
flag_value=0
do istat=2,20
r_nums(istat) = irand(flag_value)
end do