Message: Re: Seed for Random Engines Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Re: Seed for Random Engines 

Forum: Run Management
Re: Question Seed for Random Engines
Re: More Re: Seed for Random Engines (Gabriele Cosmo)
Date: 05 Aug, 2011
From: Asja Pfaffenberger <Asja Pfaffenberger>

Dear Gabriele,

I am just having a seed problem myself and found your reply looking for answers in the forum. - It seems to contradict what i see so i am wondering if there is something i am overlooking. I would be grateful if you (or somebody else) could have a quick look on the following lines.

In a modified version of the extended/medical/dicom example v.9.4.p02, i set in my main

> CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);

pick a seed from the seed table according to a seedIndex which i change for every run:

> long seeds[2];
> CLHEP::HepRandom::getTheTableSeeds(seeds,seedIndex);

use one of them to initialize random number generator

> CLHEP::HepRandom::setTheSeed(seeds[0]);

Now, if i do a

> G4cout << "DicomPrimaryGeneratorAction::GeneratePrimaries: seed= " << CLHEP::HepRandom::getTheSeed() << G4endl;

in DicomPrimaryGeneratorAction::GeneratePrimaries, i get "1" every time GeneratePrimaries is invoked. The sequence of G4UniformRand() numbers generated during the events of one run is then the same for every run, no matter what index i give in main. Is there something i am doing wrong? Or what should i check to find out?

I had an output of the seed[0] in main, which nicely gives the respective entry in SeedTable.h, while a G4cout of CLHEP::HepRandom::getTheSeed() in main, directly after the setTheSeed returns a different value (e.g. seeds[0]=1315342834, getTheSeed returns 139), but this changes with a different seeds[0] so i was not so concerned but still i do not understand why?

Thanks a lot Asja

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

1 Idea: Re: Seed for Random Engines   (Tom Roberts - 05 Aug, 2011)
1 None: Re: Seed for Random Engines   (Asja Pfaffenberger - 05 Aug, 2011)
2 More: Re: Seed for Random Engines   (Gabriele Cosmo - 05 Aug, 2011)
1 Ok: Re: Seed for Random Engines   (Asja Pfaffenberger - 05 Aug, 2011)
(_ More: Re: Seed for Random Engines   (Gabriele Cosmo - 05 Aug, 2011)
 Add Message Add Message
to: "Re: Seed for Random Engines"

 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 ]