IAP GITLAB

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

SetSeedSeq added

parent 570a0266
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,8 @@ void corsika::random::RNGManager::RegisterRandomStream(std::string const& pStrea ...@@ -10,7 +10,8 @@ void corsika::random::RNGManager::RegisterRandomStream(std::string const& pStrea
rngs[pStreamName] = std::move(rng); rngs[pStreamName] = std::move(rng);
} }
corsika::random::RNG& corsika::random::RNGManager::GetRandomStream(std::string const& pStreamName) { corsika::random::RNG& corsika::random::RNGManager::GetRandomStream(
std::string const& pStreamName) {
return rngs.at(pStreamName); return rngs.at(pStreamName);
} }
...@@ -22,3 +23,8 @@ std::stringstream corsika::random::RNGManager::dumpState() const { ...@@ -22,3 +23,8 @@ std::stringstream corsika::random::RNGManager::dumpState() const {
return buffer; return buffer;
} }
void corsika::random::RNGManager::SetSeedSeq(std::string const& pStreamName,
std::seed_seq const& pSeedSeq) {
seeds[pStreamName] = pSeedSeq;
}
...@@ -38,7 +38,12 @@ namespace corsika::random { ...@@ -38,7 +38,12 @@ namespace corsika::random {
* into a std::stringstream. * into a std::stringstream.
*/ */
std::stringstream dumpState() const; std::stringstream dumpState() const;
/**
* set seed_seq of \a pStreamName to \a pSeedSeq
*/
void SetSeedSeq(std::string const& pStreamName, std::seed_seq& const pSeedSeq);
}; };
} // namespace Random } // namespace corsika::random
#endif #endif
...@@ -21,6 +21,8 @@ SCENARIO("random-number streams can be registered and retrieved") { ...@@ -21,6 +21,8 @@ SCENARIO("random-number streams can be registered and retrieved") {
THEN("an unknown sequence cannot be retrieved") { THEN("an unknown sequence cannot be retrieved") {
REQUIRE_THROWS(rngManager.GetRandomStream("stream_UNKNOWN")); REQUIRE_THROWS(rngManager.GetRandomStream("stream_UNKNOWN"));
} }
// seeding not covered yet
} }
} }
} }
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