|
CDT++ 1.0.0
Causal Dynamical Triangulations in C++
|
A run-owned PCG engine with a recorded seed and stream identifier. More...
#include <Random.hpp>
Public Types | |
| using | result_type = pcg64::result_type |
| Unsigned result type required by std::uniform_random_bit_generator. | |
Public Member Functions | |
| Random () | |
| Construct a root stream from operating-system entropy. | |
| Random (RandomSeed const seed, RandomStream const stream=RandomStream{}) | |
| Construct a reproducible PCG stream without consulting entropy. | |
| Random (std::uint64_t const seed) | |
| Construct a root stream from a raw seed value. | |
| auto | operator() () -> result_type |
| auto | seed () const noexcept -> RandomSeed |
| auto | serialized_state () const -> std::string |
| Serialize the complete mutable PCG state for exact continuation. | |
| auto | split (RandomStream const stream) const -> Random |
| Create a fresh reproducible stream from the same root seed. | |
| auto | stream () const noexcept -> RandomStream |
Static Public Member Functions | |
| static auto | from_serialized_state (RandomSeed const seed, RandomStream const stream, std::string_view const state) -> Random |
| Restore an exact PCG continuation point. | |
| static constexpr auto | max () noexcept -> result_type |
| static constexpr auto | min () noexcept -> result_type |
A run-owned PCG engine with a recorded seed and stream identifier.
Construct one root engine per simulation. Pass engines by reference to distributions and stochastic algorithms instead of drawing fresh entropy for each sample. split() creates a reproducible, independently parameterized PCG stream for a subsystem or worker.
Random is intentionally not internally synchronized. A mutable instance belongs to one run or one thread. Parallel code must give each worker a distinct stream before drawing from it.
Definition at line 136 of file Random.hpp.
| using cdt::Random::result_type = pcg64::result_type |
Unsigned result type required by std::uniform_random_bit_generator.
Definition at line 140 of file Random.hpp.
|
inline |
Construct a root stream from operating-system entropy.
Definition at line 158 of file Random.hpp.
References Random().
Referenced by Random(), Random(), from_serialized_state(), and split().
|
inlineexplicit |
Construct a root stream from a raw seed value.
| seed | Root seed recorded for the run. |
Definition at line 162 of file Random.hpp.
|
inlineexplicit |
|
inlinestaticnodiscard |
Restore an exact PCG continuation point.
| seed | Recorded root seed. |
| stream | Recorded stream selector. |
| state | Complete state produced by serialized_state(). |
| std::invalid_argument | if the state is malformed, contains trailing data, or selects a different PCG stream. |
Definition at line 218 of file Random.hpp.
References Random(), seed(), and stream().
Referenced by main().
|
inlinestaticnodiscardconstexprnoexcept |
Definition at line 178 of file Random.hpp.
|
inlinestaticnodiscardconstexprnoexcept |
Definition at line 174 of file Random.hpp.
|
inlinenodiscard |
Definition at line 182 of file Random.hpp.
|
inlinenodiscardnoexcept |
Definition at line 185 of file Random.hpp.
Referenced by Random(), Random(), and from_serialized_state().
|
inlinenodiscard |
Serialize the complete mutable PCG state for exact continuation.
Definition at line 199 of file Random.hpp.
|
inlinenodiscard |
Create a fresh reproducible stream from the same root seed.
| stream | PCG sequence selector for the new engine. |
Definition at line 194 of file Random.hpp.
|
inlinenodiscardnoexcept |
Definition at line 188 of file Random.hpp.
Referenced by Random(), from_serialized_state(), and split().