From cd86021d3c2e727937598e6613a874c672c9249b Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Fri, 28 Sep 2018 18:15:40 +0200
Subject: [PATCH] SetSeedSeq added

---
 Framework/Random/RNGManager.cc | 8 +++++++-
 Framework/Random/RNGManager.h  | 7 ++++++-
 Framework/Random/testRandom.cc | 2 ++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Framework/Random/RNGManager.cc b/Framework/Random/RNGManager.cc
index 01bc247b4..b65f59ab5 100644
--- a/Framework/Random/RNGManager.cc
+++ b/Framework/Random/RNGManager.cc
@@ -10,7 +10,8 @@ void corsika::random::RNGManager::RegisterRandomStream(std::string const& pStrea
   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);
 }
 
@@ -22,3 +23,8 @@ std::stringstream corsika::random::RNGManager::dumpState() const {
 
   return buffer;
 }
+
+void corsika::random::RNGManager::SetSeedSeq(std::string const& pStreamName,
+                                             std::seed_seq const& pSeedSeq) {
+  seeds[pStreamName] = pSeedSeq;
+}
diff --git a/Framework/Random/RNGManager.h b/Framework/Random/RNGManager.h
index 52e53cd75..a3a6d4e53 100644
--- a/Framework/Random/RNGManager.h
+++ b/Framework/Random/RNGManager.h
@@ -38,7 +38,12 @@ namespace corsika::random {
      * into a std::stringstream.
      */
     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
diff --git a/Framework/Random/testRandom.cc b/Framework/Random/testRandom.cc
index f2d6fcdca..222a25549 100644
--- a/Framework/Random/testRandom.cc
+++ b/Framework/Random/testRandom.cc
@@ -21,6 +21,8 @@ SCENARIO("random-number streams can be registered and retrieved") {
       THEN("an unknown sequence cannot be retrieved") {
         REQUIRE_THROWS(rngManager.GetRandomStream("stream_UNKNOWN"));
       }
+
+      // seeding not covered yet
     }
   }
 }
-- 
GitLab