source/Random.h
/**
     * Generate a random variable drawn from a unit normal distribution.
     **/
Generate a random variable drawn from a unit normal distribution.
Generate a random variable drawn from a unit normal distribution .
inline double GetRandNormal() {
      double expRV2;
      while (1) {
        expRV2 = -log(GetDouble());
        expRV -= (expRV2-1)*(expRV2-1)/2;
        if (expRV > 0) break;
        expRV = -log(GetDouble());
      }
      if (P(.5)) return expRV2;
      return -expRV2;
    }
inline double GetRandNormal ( ) { double expRV2 ; while ( 1 ) { expRV2 = - log ( GetDouble ( ) ) ; expRV -= ( expRV2 - 1 ) * ( expRV2 - 1 ) / 2 ; if ( expRV > 0 ) break ; expRV = - log ( GetDouble ( ) ) ; } if ( P ( .5 ) ) return expRV2 ; return - expRV2 ; }
Generate a random variable drawn from a unit normal distribution.
Generate a random variable drawn from a unit normal distribution .
// Draw from a Unit Normal Dist // Using Rejection Method and saving of initial exponential random variable