template<typename digit_gen>
class exrandom::unit_normal_kahn< digit_gen >
Sample u-rands from the normal distribution, Kahn's method (deprecated)
This samples from the unit normal distribution P(x) = exp(− x2/2) / √(2π) using Kahn's method This implements Algorithm K.
- Template Parameters
-
digit_gen | the type of digit generator. |
WARNING: One of the steps of this algorithm requires the use of arbitrary precision integer arithmetic. However in this implementation the arithmetic is carried out with 64-bit integers. As a result there is occasionally (1 time in 109) overflow which results in a bias in the results. Use of this class is therefore deprecated.
digit_gen::base cannot exceed 16.
- Examples
- count_bits.cpp.
Definition at line 38 of file unit_normal_kahn.hpp.
template<typename digit_gen>
template<typename RealType , typename Generator >
Return the midpoint of the next deviate with a specified number of digits.
- Template Parameters
-
RealType | the floating point type of the result. |
Generator | the type of g. |
- Parameters
-
g | the random generator engine. |
k | the minimum number of digits in the fraction. |
- Returns
- the normal deviate.
Note the k gives the numer of digits in the base base.
Definition at line 134 of file unit_normal_kahn.hpp.