*
      function rnd()
C                  lewis, goodman, miller random number generator

      parameter (ALOW=1.e-15, AHIGH=1.-1.e-15)

      data nsd/1073741823/
C              2 ** 30 - 1
    1 nsd=mod(16807*nsd,2147483647)
C             7**5 & 2**31-1[=2*(2**30-1)+1]
      if (nsd .lt. 0) nsd = -nsd
      rnd=(0.4656612875e-09)*float(nsd)
C           1.0 / ( 2 **31 - 1 )
      if ( rnd .gt. ALOW .and. rnd .lt. AHIGH ) return
      if (nsd.eq.0) then
         nsd = 1073741823
         write(*,*) ' ERROR in RANF - SEED RESET TO DEFAULT'
      endif
      go to 1
C                                              no return with 1 or 0
      end
