Add below headers in main file.
#include "Randomize.hh"
#include "time.h"
Add below lines in main() function.
//choose the Random engine
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine());
//set random seed with system time
G4long seed = time(NULL);
CLHEP::HepRandom::setTheSeed(seed);
The running results will be different though you use the same number of events in different runs.
Worked a treat. Thanks.
ReplyDeleteThanks a lot. It worked!
ReplyDeletethanks a lot, there should be a stronger community and better documentation for geant4
ReplyDelete