Message: Setting RNG Seeds in MT main() not working Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Setting RNG Seeds in MT main() not working 

Forum: Multithreading
Date: 27 Jun, 2018
From: William Donahue <William Donahue>


I am trying to have my G4 application run with a different random number seed each time I start if from the terminal. Following all the advice online I have inserted the following code (placed right after instantiating the run manager)

  // setup new RNG
  std::random_device r;
  std::seed_seq seed2{r(), r(), r(), r(), r(), r(), r(), r()};
  std::mt19937 e2(seed2);
  G4Random::setTheEngine(new CLHEP::RanecuEngine);
  G4long seeds[2];
  time_t systime = std::time(0);

  seeds[0] = (long) e2();
  seeds[1] = (long) e2();
  //set user action classes

However the same random numbers are used each time. This occurs independently on the random number engine selected and the seeds provided.

Instantiating the non-MT Run Manager relives this issue. But once i go back to an MT Run Manager it all becomes the same random numbers again.

I want to avoid having to change the seed manually in the script files, which is where I have seen the previous fixes focused.

System details: G4 Version: geant4-10-04 [MT] (08-December-2017) Intel C++ 18.0.1 Fedora 26 latest build


Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Setting RNG Seeds in MT main() not working   (William Donahue - 28 Jun, 2018)
(_ Note: Re: Setting RNG Seeds in MT main() not working   (William Donahue - 27 Aug, 2018)
 Add Message Add Message
to: "Setting RNG Seeds in MT main() not working"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews