Message: Re: Random Numbers Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Random Numbers 

Keywords: Random, CLHEP, HepRep, Ranecu
Forum: Run Management
Re: None Random Numbers (Theo DuBose)
Date: 24 Aug, 2007
From: Gumplinger Peter <Gumplinger Peter>

OK, try this in your main program:

int main(int argc,char** argv)
  G4int seed = -1;
  if (argc >= 3) seed = atoi(argv[2]);
  if (seed < 0) seed = time(0);

assuming you run your program with

program rand#


macro file:

rand#: any integer; e.g 123456

and if you start without specifying rand#:


the seed will change and derived from the time.

Without the above code, HepRandom is internally seeded and always the same and thus your simulation will identically repeat itself.

Some people like to derive the initial seed from the initial event number which is specified sequentially (differently) for long production runs to ensure the simulations are different.

Please also see:

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

 Add Message Add Message
to: "Re: Random Numbers"

 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 ]