C This version uses ran2.f

      FUNCTION gasdev(idum) 
      REAL gasdev
      SAVE iset,gset
      DATA iset/0/
      IF (iset.eq.0) THEN
 1      v1=2.*ran2(idum)-1. 
        v2=2.*ran2(idum)-1.
        rsq=v1**2+v2**2
        IF(rsq.ge.1..or.rsq.eq.0.)GOTO 1
        fac=SQRT(-2.*LOG(rsq)/rsq)
        gset=v1*fac 
        gasdev=v2*fac 
        iset=1
      ELSE
        gasdev=gset 
        iset=0
      ENDIF 
      RETURN
      END 
