RandomLib  1.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Public Member Functions | List of all members
RandomLib::MPFRUniform< bits > Class Template Reference

The uniform distribution for MPFR. More...

#include <RandomLib/MPFRUniform.hpp>

Public Member Functions

 MPFRUniform ()
void operator() (MPFRRandom< bits > &t, gmp_randstate_t r) const
int operator() (mpfr_t val, gmp_randstate_t r, mpfr_rnd_t round) const

Detailed Description

template<int bits = 32>
class RandomLib::MPFRUniform< bits >

The uniform distribution for MPFR.

This is just a thin layer on top of MPFRRandom to provide random numbers uniformly distributed in [0,1].

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

Template Parameters
bitsthe number of bits in each digit.

Definition at line 33 of file MPFRUniform.hpp.

Constructor & Destructor Documentation

template<int bits = 32>
RandomLib::MPFRUniform< bits >::MPFRUniform ( )

Initialize the MPFRUniform object.

Definition at line 39 of file MPFRUniform.hpp.

Member Function Documentation

template<int bits = 32>
void RandomLib::MPFRUniform< bits >::operator() ( MPFRRandom< bits > &  t,
gmp_randstate_t  r 
) const

Sample from the uniform distribution in [0,1] returning a MPFRRandom. This function takes an unused GMP random generator as a parameter, in order to parallel the usage of MPFRExponential and MPFRNormal.

[out]tthe MPFRRandom result.
[in,out]ra GMP random generator (unused).

Definition at line 48 of file MPFRUniform.hpp.

template<int bits = 32>
int RandomLib::MPFRUniform< bits >::operator() ( mpfr_t  val,
gmp_randstate_t  r,
mpfr_rnd_t  round 
) const

Sample from the uniform distribution in [0,1].

[out]valthe sample from the uniform distribution
[in,out]ra GMP random generator.
[in]roundthe rounding direction.
the MPFR ternary result (± if val is larger/smaller than the exact sample).

Definition at line 59 of file MPFRUniform.hpp.

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