      double precision function nrnd(urnd)
c
c     generate normal random number using the uniform
c     random function urnd
c
c     REFERENCE: "RANSUU (UP ouyou suugaku sensho 12)"
c       Masanori Fushimi, Univ. of Tokyo press. 1989 pp.69
c
      real*8 urnd
      real*8 u1, u2, nrndsq
      real*8 c1, c2, c3

C     parameter (e = 2.71828182845904523536D0)
C     parameter (c1 = (8.0d0/e)**0.5d0)
C     parametar (c2 = 4.0d0 * e**0.25d0)
C     parameter (c3 = 4.0d0 * e**(-1.35d0))

      parameter (c1 = 1.715527769921413537D0)
      parameter (c2 = 5.136101666750965578D0) 
      parameter (c3 = 1.036961042583566028D0) 


 10   continue
         u1 = urnd()
         u2 = urnd()

         nrnd = c1 * (u2 - 0.5d0) / u1
         nrndsq = nrnd**2
         if (nrndsq .le. 5.d0 - c2 * u1) return
         if (nrndsq .ge. c3 / u1 + 1.4d0) go to 10
         if (nrndsq .le. -4 * log(u1)) return

      go to 10
      end

