From 527835991a10bcd6bdfa7da9f3cf10c40bc1b919 Mon Sep 17 00:00:00 2001
From: Tom Polakovic <tpolakovic@anl.gov>
Date: Tue, 21 Jul 2020 13:17:53 -0500
Subject: [PATCH] RNG seed as environmental variable

---
 forward_ions.cxx | 2 +-
 setup.sh         | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 setup.sh

diff --git a/forward_ions.cxx b/forward_ions.cxx
index 4b42997..5c7a609 100644
--- a/forward_ions.cxx
+++ b/forward_ions.cxx
@@ -13,7 +13,7 @@ void forward_ions(){
   WriterAscii hepmc_output("data/forward_ions.hepmc");
   int        events_parsed = 0;
   GenEvent   evt(Units::GEV, Units::MM);
-  std::mt19937 gen(1337);
+  std::mt19937 gen( std::stoi(std::getenv("SEED")) );
   std::uniform_real_distribution<double> phi_distr(0,6.2831853072);
   std::uniform_real_distribution<double> theta_distr(0,0.01745329252);
 
diff --git a/setup.sh b/setup.sh
new file mode 100644
index 0000000..91f9519
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1 @@
+export SEED="1337"
-- 
GitLab