Message: Re: Is random engine used in AnaEx01? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

More Re: Is random engine used in AnaEx01? 

Forum: Documentation and Examples
Re: Question Is random engine used in AnaEx01? (Neoh)
Date: 29 Jan, 2010
From: Gabriele Cosmo <Gabriele Cosmo>


as beginner you may want to have a look at the documentation first...

> CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
> is used to instantiate a static random engine, which will internally set a seed.

Right. This shows you how to set a random engine from the many engines
available in CLHEP. Each engine has its default initial seed.

> This same seed will be used in every run, which is why the results are all same
> in every run. But a different seed will be provided if the program is recompiled.

No. Recompilation of the program will not change the random sequence. The
random sequence would change only if you modify the initial seed of the engine.
Although it is not a recommended practice, some applications may do this by
initialising the seed with the system time, so one gets different results each
time the application is executed...
The seed can either be changed directly in the code (and in this case, as
RanecuEngine is used, it can be represented by a couple of numbers), using:
    // 'seeds' is an array of two positive numbers X,Y you choose
or at run-time from the application's prompt (or adding it to the input macro,
here run.mac), using the command:
    /random/setSeeds X Y
You should be able to find all this in the documentation.


 Add Message Add Message
to: "Re: Is random engine used in AnaEx01?"

 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 ]