|Message: Re: Seed for Random Engines||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
Hi Asja, > 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. there is no contradiction, but I see here there is a bit of confusion... > 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; > > CLHEP::HepRandom::getTheTableSeeds(seeds,seedIndex); > > use one of them to initialize random number generator > > > CLHEP::HepRandom::setTheSeed(seeds); Here you're using a different method, setTheSeed() instead of setTheSeeds(). If you read the documentation for RanecuEngine, you'll see that SetTheSeed() for Ranecu will simply set the "index" in the Table of seeds, index which is normalized to 215, as the table has only 215 entries. > Now, if i do a > > > G4cout << "DicomPrimaryGeneratorAction::GeneratePrimaries: seed= " << > CLHEP::HepRandom::getTheSeed() << G4endl; > > in DicomPrimaryGeneratorAction::GeneratePrimaries, i get "1" every time > GeneratePrimaries is invoked. What you get is again the "index" in the table.. The actual seeds are the -couple- of numbers 'seeds' you can get with: seeds = CLHEP::HepRandom::getTheSeeds(); > 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? For Ranecu, CLHEP::HepRandom::setTheSeed(index); where 'index' is between 0 and 214, can provide only up to 215 different seedings of the engine. You can use CLHEP::HepRandom::setTheSeeds(seeds); where 'seeds' is an array of a couple of numbers for seeding the engine as you like (which is the same behavior you can achieve using the run-time command being discussed previously in this thread...). > I had an output of the seed 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=1315342834, getTheSeed returns > 139), but this changes with a different seeds so i was not so > concerned but still i do not understand why? The index gets normalized, as I said above. Though, note that all this applies only for Ranecu and Ranlux engines. There're also faster or more advanced engines available in CLHEP you can choose... Cheers, Gabriele
|Inline Depth:||Outline Depth:||Add message:|