Random number generationΒΆ
To generate random numbers we need to
include
<dust/random/random.hpp>
decide on the generator algorithm to use
seed a random number state
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