RandomLib  1.10
RandomLib::MPFRNormalR Class Reference

The normal distribution for MPFR (ratio method). More...

#include <RandomLib/MPFRNormalR.hpp>

## Public Member Functions

MPFRNormalR ()

~MPFRNormalR ()

int operator() (mpfr_t val, gmp_randstate_t r, mpfr_rnd_t round) const

## Detailed Description

The normal distribution for MPFR (ratio method).

This class is DEPRECATED. It is included for illustrative purposes only. The MPFRNormal class provides a much more efficient method for sampling from the normal distribution.

This is an adaption of NormalDistribution to MPFR. The changes are

• Use MPFR's random number generator
• Use sufficient precision internally to ensure that a correctly rounded result is returned.

This class uses a mutable private object. So a single MPFRNormalR object cannot safely be used by multiple threads. In a multi-processing environment, each thread should use a thread-specific MPFRNormalR object.

Definition at line 43 of file MPFRNormalR.hpp.

## Constructor & Destructor Documentation

 RandomLib::MPFRNormalR::MPFRNormalR ( )
inline

Initialize the MPFRNormalR object.

Definition at line 55 of file MPFRNormalR.hpp.

 RandomLib::MPFRNormalR::~MPFRNormalR ( )
inline

Destroy the MPFRNormalR object.

Definition at line 70 of file MPFRNormalR.hpp.

## Member Function Documentation

 int RandomLib::MPFRNormalR::operator() ( mpfr_t val, gmp_randstate_t r, mpfr_rnd_t round ) const
inline

Sample from the normal distribution with mean 0 and variance 1.

Parameters
 [out] val the sample from the normal distribution [in,out] r a GMP random generator. [in] round the rounding direction.
Returns
the MPFR ternary result (±1 if val is larger/smaller than the exact sample).

Definition at line 91 of file MPFRNormalR.hpp.

The documentation for this class was generated from the following file: