Random number generationΒΆ

To generate random numbers we need to

  1. include <dust/random/random.hpp>

  2. decide on the generator algorithm to use

  3. seed a random number state

  4. draw numbers using some distribution function

A simple complete example looks like

#include <iostream>
#include <dust/random/random.hpp>

int main() {
  using rng_state_type = dust::random::generator<double>;
  auto state = dust::random::seed<rng_state_type>(42);
  for (int i = 0; i < 5; ++i) {
    std::cout << dust::random::random_real<double>(state) << std::endl;
  }
}

which produces output:

0.496954
0.689618
0.366961
0.362038
0.929985