C.hr UNSK   
C@
C....*...1.........2.........3.........4.........5.........6.........7.*
      REAL FUNCTION UNSK(IXX)
C  GENERATES NORMAL(0,1) RV'S USING KNUTH'S (V.2,2ND ED P125-7) VERSION
C  OF KINDERMAN-MONAHAN RATIO OF UNIFORMS (ACMTOMS,1977,P257-60) METHOD
C  MODIFIED 5/24/91 BY A R GALLANT TO SET SEED DIFFERENTLY
C  WARNING: DECLARE UNSK REAL*4 IN CALLING PROGRAM
      DATA A/1.7155277/,B/5.136101667/,C/1.036961/
      SAVE
  1   U=RAN(IXX)
C  A=SQRT(8/E)
      V=RAN(IXX)
      UNSK=A*(V-0.5)/U
      ZZ=UNSK*UNSK
C  B=4*EXP(1/4)
      IF(ZZ.LE.5.-B*U) RETURN
C  THIS IS KNUTH'S QUICK REJECT TEST,  C=4*EXP(-1.35)
      IF(ZZ.GE.C/U+1.4) GO TO 1
      IF(ZZ.LE.-4.*ALOG(U)) RETURN
      GO TO 1
      END
