Message: Identical output using autoseeding in MT mode with version 4.10 Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Identical output using autoseeding in MT mode with version 4.10 

Forum: Run Management
Date: 09 Dec, 2014
From: <padraig.looney@nhs.net>

I have the following code in the constructor of a RunAction for auto-seeding

    time_t systime = time(NULL);
    G4Random::setTheEngine(new CLHEP::RanecuEngine()); //selection of a random engine
    G4Random::setTheSeed(systime);

    long seeds[2];
    seeds[0] = (long) systime;
    seeds[1] = (long) (systime*G4UniformRand());
    G4Random::setTheSeeds(seeds);
    G4Random::showEngineStatus();

    std::string configName = std::string(dirName) + "/Config.conf";
    G4Random::saveEngineStatus(configName.c_str());

It is based on example extended/common/src/ExG4RunAction01.cc. The output to the Config.conf file is different every time.

However, the output of my my program is identical everytime. Also I noticed that if I do not set the seed before calling G4UniformRand() then I get the same value every time for G4UniformRand(). What is the correct way to automatically generate different seeds?

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

1 None: Re: Identical output using autoseeding in MT mode with version 4.10   (padraig.looney@nhs.net - 09 Dec, 2014)
 Add Message Add Message
to: "Identical output using autoseeding in MT mode with version 4.10"

 Subscribe Subscribe

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


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]