Problems with Random

I faced such problem. I need to generate a random location in the ParticleGun where the interaction takes place. To do this, I use the function: r = G4RandGauss::shoot(3.90,0.30). But then I get the same value of r when starting each new event every time the program is started. I tried to figure it out myself. I realized that I need to change the initial value of the Seed for random number generator. I used this code:
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
Now I have different values ​​for different runs of the program, however, the value of r for each event in this run is still the same. What should be done to make them different for each event?

Thanks for the help.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.