12 #if !defined(RANDOMLIB_MPFREXPONENTIAL_HPP)
13 #define RANDOMLIB_MPFREXPONENTIAL_HPP 1
17 #if HAVE_MPFR || defined(DOXYGEN)
49 { Compute(r); _x.swap(t); }
59 int operator()(mpfr_t val, gmp_randstate_t r, mpfr_rnd_t round)
const
60 { Compute(r);
return _x(val, r, round); }
70 if (!_w.LessThan(r, p))
return 1;
72 _v.Init();
if (!_v.LessThan(r, _w))
return 0;
73 _w.Init();
if (!_w.LessThan(r, _v))
return 1;
76 void Compute(gmp_randstate_t r)
const {
79 while (!ExpFraction(r, _x)) { ++k; _x.Init(); }
80 if (k & 1) _x.SetHighBit(r);
81 _x.AddInteger(k >> 1);
84 mutable MPFRRandom<bits> _x;
85 mutable MPFRRandom<bits> _v;
86 mutable MPFRRandom<bits> _w;
92 #endif // RANDOMLIB_MPFREXPONENTIAL_HPP
void operator()(MPFRRandom< bits > &t, gmp_randstate_t r) const
int TestHighBit(gmp_randstate_t r)
Handling random numbers in MPFR.
The exponential distribution for MPFR.
int operator()(mpfr_t val, gmp_randstate_t r, mpfr_rnd_t round) const