RAND — Real pseudo-random number#
- 
RAND(FLAG)#
- RAND(FLAG)returns a pseudo-random number from a uniform distribution between 0 and 1. If- FLAGis 0, the next number in the current sequence is returned; if- FLAGis 1, the generator is restarted by- CALL SRAND(0); if- FLAGhas any other value, it is used as a new seed with- SRAND.- Parameters:
- I – Shall be a scalar - INTEGERof kind 4.
- Returns:
- The return value is of - REALtype and the default kind.
 - Standard:
- GNU extension 
- Class:
- Function 
- Syntax:
- RESULT = RAND(I) 
- Example:
- program test_rand integer,parameter :: seed = 86456 call srand(seed) print *, rand(), rand(), rand(), rand() print *, rand(seed), rand(), rand(), rand() end program test_rand 
- See also:
- SRAND — Reinitialize the random number generator, RANDOM_NUMBER — Pseudo-random number