IBM Books

Language Reference


SRAND(SEED)

Provides the seed value used by the random number generator function RAND.

SEED
must be scalar. It must be of type REAL(4) when used to provide a seed value for the RAND function, or of type INTEGER(4) when used to provide a seed value for the IRAND service and utility function. It is an INTENT(IN) argument.

Class

Subroutine

Examples

The following is an example of a program using the SRAND subroutine.

CALL SRAND(0.5)
DO I = 1, 5
   R = RAND()
   PRINT *,R
ENDDO
END

The following is sample output generated by the above program:

0.3984375000
0.4048461914
0.1644897461
0.1281738281E-01
0.2313232422E-01


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ] © Copyright IBM Corporation 1990, 1998