      SUBROUTINE RAND(IX,IY,YFL)
C
C       THIS SUBROUTINE GENERATES RANDOM NUMBERS BETWEEN
C       0 AND 1 (SUN VERSION)
C
C       IX - INITIAL SEED
C
C       IY - NEW SEED VALUE
C
C       YFL - RANDOM NUMBER DOUBLE PRECISION
C
      DOUBLE PRECISION   YFL
      DOUBLE PRECISION   DRAND48
      INTEGER IX
      INTEGER IY
      INTEGER ISEED
      LOGICAL FIRST
      DATA    FIRST /.TRUE./
      SAVE    FIRST, ISEED
C
C     IF THIS IS THE FIRST CALL, INITIALIZE TOPMOST 32 BITS OF THE SEED
C
      IF (FIRST .OR. ISEED .NE. IX) THEN
        CALL SRAND48 (IX)
        FIRST = .FALSE.
      END IF
C
C     USE SUN-SUPPLIED FUNCTION DRAND48
C
      IY = IX
      ISEED = IX
      YFL = DRAND48()
C
      RETURN
      END
