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

None Re: Seed for Random Engines 

Forum: Run Management
Re: Question Seed for Random Engines
Date: 14 Jul, 2011
From: Paul Nicholas Colin Gloster <Paul Nicholas Colin Gloster>

Someone sent on July 14th, 2011:
|------------------------------------------------------------------------|
|"I still have some problems in understanding the setting of the seed for|
|the Random Engines. If I set a seed=35678 for an engine in the main of  |
|the example.cc this seed is used by the engine for each run (/run/beamOn|
|) I start, so that every run produces the same results. Doing more than |
|one run by calling /run/beamOn several times, the seed has to be changed|
|for each run. I hope that I am right up to here?"                       |
|------------------------------------------------------------------------|

You are using an imperative language so variables are mutable if they
are not declared as const. If the seed has not been changed (and you
also use the same executable and the same pseudorandom engine (Ranecu
is not the only one)), then you would have the same results for each
run.

|------------------------------------------------------------------------|
|"What is the easiest way                                                |
|to change the seed for each run, by not changing the code and           |
|recompiling the example? [..]                                           |
|[..]"                                                                   |
|------------------------------------------------------------------------|

Which example? Anyway, would you find it easiest to let the program
read the seed on the command line and to automatically run, instead of
manually running  /run/beamOn  interactively? That is what I usually
do.

If you really do not want to do it that way, have you thought of
something like  /random/setSeeds  ?

|------------------------------------------------------------------------|
|"Another point is: If I want to produce more than one event, e.g. 1000  |
|events, during a run (/run/beamOn 1000). Are these 1000 events          |
|statistically independent, by setting the seed in the way described     |
|above?                                                                  |
|                                                                        |
|Thanks for your help."                                                  |
|------------------------------------------------------------------------|

Well, yes and no. The numbers in a non-repeating series of
pseudorandom numbers do depend on each other: they must, otherwise
they would be truly random. (When the series becomes long enough that
it does repeat, then this is more obvious.)

As for the events themselves, the second event would not be affected
by the first event, unless maybe the first particle (or a resulting
secondary particle) is still in the Universe.

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

1 Question: Re: Seed for Random Engines   (Mike - 16 Jul, 2011)
(_ None: Re: Seed for Random Engines   (=?UTF-8?Q?Nicholas_Collin_Paul_de_Glouce=C5=BFter?= - 18 Jul, 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 ]