numerics
0.1.0
Loading...
Searching...
No Matches
rng.hpp
Go to the documentation of this file.
1
/// @file markov/rng.hpp
2
/// @brief RNG seeding utilities for MCMC simulations.
3
#pragma once
4
#include <random>
5
6
namespace
num::markov
{
7
8
/// @brief Construct an RNG seeded from hardware entropy.
9
///
10
/// Equivalent to `RNG(std::random_device{}())`. Use this at simulation
11
/// startup for non-deterministic seeds.
12
///
13
/// @tparam RNG Any standard-library-compatible random number engine.
14
/// Defaults to std::mt19937.
15
template
<
typename
RNG = std::mt19937>
16
RNG
make_seeded_rng
() {
17
std::random_device rd;
18
return
RNG(rd());
19
}
20
21
/// @brief Construct an RNG from a fixed seed (for reproducible runs).
22
template
<
typename
RNG = std::mt19937>
23
RNG
make_rng
(
typename
RNG::result_type seed) {
24
return
RNG(seed);
25
}
26
27
}
// namespace num::markov
num::markov
Definition
boltzmann_table.hpp:18
num::markov::make_seeded_rng
RNG make_seeded_rng()
Construct an RNG seeded from hardware entropy.
Definition
rng.hpp:16
num::markov::make_rng
RNG make_rng(typename RNG::result_type seed)
Construct an RNG from a fixed seed (for reproducible runs).
Definition
rng.hpp:23
include
stochastic
rng.hpp
Generated by
1.9.8