22template <std::
floating_po
int Real, std::uniform_random_bit_generator G>
33 Real
height =
static_cast<Real
>(table[
layer].first - table[
layer - 1].first);
37 throw std::runtime_error(
"Exponential distribution: sampling failed");
44template <std::
floating_po
int Real, std::uniform_random_bit_generator G>
57 const Real r =
static_cast<Real
>(table[1].second);
62 }
while (e + e <= x * x);
65 Real
height =
static_cast<Real
>(table[
layer].first - table[
layer - 1].first);
69 throw std::runtime_error(
"Normal distribution: sampling failed");
constexpr std::size_t MAX_ITER_REJECTION
Upper bound on the iterations of rejection samplers; reaching it means there is a bug.
Definition variates.hpp:16
Real standardExponential(G &g)
Ziggurat algorithm of Marsaglia and Tsang with 256 layers.
Definition variates.hpp:23
constexpr std::array< std::pair< long double, long double >, 257 > normalZiggurat
(exp(-x^2 / 2), x) at the layer boundaries of the normal ziggurat
Definition ziggurat_tables.hpp:12
std::uint64_t randomBits(G &g, int count)
Definition engine/uniform.hpp:33
constexpr std::array< std::pair< long double, long double >, 257 > exponentialZiggurat
(exp(-x), x) at the layer boundaries of the exponential ziggurat
Definition ziggurat_tables.hpp:273
Real standardNormal(G &g)
Ziggurat algorithm of Marsaglia and Tsang with 256 layers and an explicit sign bit.
Definition variates.hpp:45