SRAND(SEED) (IBM extension)

Purpose

Provides the seed value used by the random number generator function RAND. This intrinsic subroutine is not recommended. Use the standards conforming RANDOM_NUMBER(HARVEST) intrinsic subroutine.

Class

Subroutine

Argument type and attributes

SEED
  • An INTENT(IN) REAL(4) scalar when used to provide a seed value for the RAND function
  • An INTENT(IN) INTEGER(4) scalar when used to provide a seed value for the IRAND service and utility function.

Examples

See the following example of a program using the SRAND subroutine.
CALL SRAND(0.5)
DO I = 1, 5
   R = RAND()
   PRINT *,R
ENDDO
END
See the following sample output generated by the above program:
0.3984375000
0.4048461914
0.1644897461
0.1281738281E-01
0.2313232422E-01