IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 5c8f6e77 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

simple-minded seed mechanism

parent 8176e9d0
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,20 @@ std::stringstream corsika::random::RNGManager::dumpState() const { ...@@ -33,6 +33,20 @@ std::stringstream corsika::random::RNGManager::dumpState() const {
return buffer; return buffer;
} }
void corsika::random::RNGManager::SeedAll(uint64_t vSeed) {
for (auto& entry : rngs) { entry.second.seed(vSeed++); }
}
void corsika::random::RNGManager::SeedAll() {
std::random_device rd;
for (auto& entry : rngs) {
std::seed_seq sseq{rd(), rd(), rd(), rd(), rd(), rd()};
entry.second.seed(sseq);
}
}
/* /*
void corsika::random::RNGManager::SetSeedSeq(std::string const& pStreamName, void corsika::random::RNGManager::SetSeedSeq(std::string const& pStreamName,
std::seed_seq const& pSeedSeq) { std::seed_seq const& pSeedSeq) {
......
...@@ -61,6 +61,14 @@ namespace corsika::random { ...@@ -61,6 +61,14 @@ namespace corsika::random {
* set seed_seq of \a pStreamName to \a pSeedSeq * set seed_seq of \a pStreamName to \a pSeedSeq
*/ */
// void SetSeedSeq(std::string const& pStreamName, std::seed_seq& const pSeedSeq); // void SetSeedSeq(std::string const& pStreamName, std::seed_seq& const pSeedSeq);
/**
* Set explicit seeds for all currently registered streams. The actual seed values
* are incremented from \a vSeed.
*/
void SeedAll(uint64_t vSeed);
void SeedAll(); //!< seed all currently registered streams with "real" randomness
}; };
} // namespace corsika::random } // namespace corsika::random
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment