|
SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
|
#include <cmath>#include <cstdint>#include <random>#include <string>

Go to the source code of this file.
Classes | |
| class | RandomStream |
| A seeded, independent stream of random numbers. More... | |
Functions | |
| std::uint64_t | DrawRandomSeed () |
| A seed drawn from the operating system's entropy source. | |
| bool | ParseRandomSeed (const std::string &text, std::uint64_t &seed) |
| Parses a user-entered seed. | |
| RandomStream & | ThreadRandomStream () |
Variables | |
| constexpr std::uint64_t | DefaultRandomSeed = 20261016 |
| The stream for code outside the MCMC that needs random numbers. | |
|
inline |
A seed drawn from the operating system's entropy source.
Used when the user leaves the seed blank. It is 32 bits so that it is easy to read back and type in to repeat a run.
Definition at line 100 of file randomstream.h.
Referenced by CMCMC< T >::initialize(), CMCMC< T >::initialize(), and ParseRandomSeed().
|
inline |
Parses a user-entered seed.
| text | Decimal digits, or blank |
| seed | Set to the parsed seed, or to a newly drawn one if text is blank |
text is neither blank nor a non-negative integer that fits in 64 bits Definition at line 112 of file randomstream.h.
References DrawRandomSeed().
Referenced by SourceSinkData::MCMC(), and Conductor::ResolveRandomSeed().
|
inline |
Definition at line 152 of file randomstream.h.
References DefaultRandomSeed.
Referenced by GADistribution::GetRndUniF(), and GetRndUnif().
|
constexpr |
The stream for code outside the MCMC that needs random numbers.
One per thread, so parallel code never shares a generator. Every thread's stream starts from the same fixed seed (DefaultRandomSeed), so a run is repeatable; code whose result must not depend on what ran before it (the Levenberg-Marquardt starting point, Error Analysis) uses its own RandomStream instead. Because every thread's stream starts from the same seed, parallel code must not draw from it: give each chain or task its own RandomStream(seed, index), as the MCMC does.
Definition at line 150 of file randomstream.h.
Referenced by SourceSinkData::SolveLevenberg_Marquardt(), and ThreadRandomStream().