c===========================================================
c     Sample probability distribution functions.
c===========================================================

c-----------------------------------------------------------
c     Generates uniform deviates.
c-----------------------------------------------------------
      subroutine puniform(x,pofx,maxpofx)
         implicit      none
         real*8        x,     pofx,    maxpofx

         maxpofx = 1.0d0
         if( 0.0d0 .le. x  .and.  x .le. 1.0d0 ) then
            pofx = 1.0d0
         else
            pofx = 0.0d0
         end if

         return
      end

c-----------------------------------------------------------
c     Generates gaussian-distributed (unit sigma) deviates.
c-----------------------------------------------------------
      subroutine pgauss(x,pofx,maxpofx)
         implicit      none
         real*8        normalize
c-----------------------------------------------------------
c        Normalization can be any non-zero value, 
c        might as well be unity.  "True" normalization 
c        is 1 / sqrt(Pi) = 0.5641 8958 3547 7563d0.
c-----------------------------------------------------------
         parameter   ( normalize = 1.0d0 )
         real*8        x,     pofx,    maxpofx

         maxpofx = normalize
         pofx    = normalize * exp(-x**2)

         return
      end
