ExRandom  3.0
sample_discrete_normal.cpp
#include <iostream>
#include <random>
#include <map>
int main() {
std::cout << "Sampling from the discrete normal distribution\n";
unsigned s = std::random_device()(); // Set seed from random_device
std::mt19937 g(s); // Initialize URNG
std::cout << "Seed set to " << s << "\n\n";
const unsigned b = 2;
N(D, 87331, 3, 16000051, 100);
std::cout << "Parameters: "
<< " mu = " << N.mu_num() << "/" << N.mu_den()
<< " sigma = " << N.sigma_num() << "/" << N.sigma_den() << "\n"
<< "columns are: uniform range, final int\n";
int num = 20;
for (int i = 0; i < num; ++i) {
N.generate(g, h);
std::cout << h << " = ";
std::cout << h(g) << "\n";
}
std::cout << "Total number of base " << b << " digits used = "
<< D.count() << "\n\n";
}