RAND, RANDOM

Portability Functions: Return real random numbers in the range 0.0 through 1.0.

Module: USE DFPORT

Syntax

result = RAND ([ iflag ])
result = RANDOM (iflag)


iflag
(Input) INTEGER(4). Optional for RAND. Controls the way the random number is selected.


Results:

The result is of type REAL(4). RAND and RANDOM return random numbers in the range 0.0 through 1.0.

Value of iflag Selection process
1 The generator is restarted and the first random value is selected.
0 The next random number in the sequence is selected.
Otherwise The generator is reseeded using iflag, restarted, and the first random value is selected.

When RAND is called without an argument, iflag is assumed to be 0.

There is no difference between RAND and RANDOM. Both functions are included to ensure portability of existing code that references one or both of them. The intrinsic functions RANDOM_NUMBER and RANDOM_SEED provide the same functionality.

Note: Because Visual Fortran offers an intrinsic subroutine also called RANDOM in the default library, the only way to access this portability function is with the USE DFPORT statement. Without it, you can only access the default subroutine.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: RANDOM_NUMBER, RANDOM_SEED, RANDOM