source/Random.h
/**
     * Generate a random variable drawn from a Binomial distribution.
     *
     * This function is faster than @ref Random::GetFullRandBinomial(), but
     * uses some approximations.
     *
     * @see Random::GetFullRandBinomial
     **/
Generate a random variable drawn from a Binomial distribution.
This function is faster than @ref Random::GetFullRandBinomial(), but
uses some approximations.


Generate a random variable drawn from a Binomial distribution . This function is faster than @ref Random :: GetFullRandBinomial () but uses some approximations .
inline uint32_t GetRandBinomial(const double n, const double p) { 
      imate Binomial if appropriate
      if (n * p * (1 - p) >= _BINOMIAL_TO_NORMAL) {
        return static_cast<uint32_t>(GetRandNormal(n * p, n * p * (1 - p)) + 0.5);
      }
      if (n >= _BINOMIAL_TO_POISSON) {
        uint32_t k = GetRandPoisson(n, p);
        if (k < UINT_MAX) return k; 
      }
      return GetFullRandBinomial(n, p);
    }
inline uint32_t GetRandBinomial ( const double n , const double p ) { if ( n * p * ( 1 - p ) >= _BINOMIAL_TO_NORMAL ) { return static_cast < uint32_t > ( GetRandNormal ( n * p , n * p * ( 1 - p ) ) + 0.5 ) ; } if ( n >= _BINOMIAL_TO_POISSON ) { uint32_t k = GetRandPoisson ( n , p ) ; if ( k < UINT_MAX ) return k ; } return GetFullRandBinomial ( n , p ) ; }
Generate a random variable drawn from a Binomial distribution.
Generate a random variable drawn from a Binomial distribution .
// Approx // Approximate Binomial if appropriate // if np(1-p) is large, use a Normal approx // elseif n is large, use a Poisson approx // if approx worked // otherwise, actually generate the randBinomial