Header-only C++ library of a fast normal random number generator implementing the ziggurat algorithm.
Download and include ziggurat.hpp. The header defines
cxx::ziggurat_normal_distribution<T>
class template. It can be used as a
replacement for std::normal_distribution
.
#include <iostream>
#include <random>
#include <ziggurat.hpp>
int main()
{
std::mt19937_64 random;
cxx::ziggurat_normal_distribution<double> normal{1.2, 0.8};
std::cout << normal(random) << '\n';
}
git clone https://github.com/snsinfu/cxx-ziggurat
cd cxx-ziggurat/tests
make
Boost Software License, Version 1.0.