SRAND

Portability Subroutine: Seeds the random number generator used with IRAND and RAND.

Module: USE DFPORT

Syntax

CALL SRAND (iseed)
CALL SRAND (rseed)


iseed
(Input) INTEGER(4). Any value.


rseed
Input) REAL(4). Any value.


SRAND seeds the random number generator used with IRAND and RAND. Calling SRAND is equivalent to calling IRAND or RAND with a new seed.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: RAND, IRAND, RANDOM_NUMBER, RANDOM_SEED

Example

 !  How many random numbers out of 100 will be between .5 and .6?
    USE DFPORT
    ICOUNT = 0
    CALL SRAND(123.4567)
    DO I = 1, 100
      X = RAND(0.0)
      IF ((X>.5).AND.(x<.6)) ICOUNT = ICOUNT + 1
    END DO
    WRITE(*,*) ICOUNT, "numbers between .5 and .6!"