Message: Re: random number generation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: random number generation 

Keywords: ranecu, random
Forum: Run Management
Re: Question random number generation (Carter Hall)
Date: 08 Nov, 2005
From: Gabriele Cosmo <Gabriele Cosmo>

Hi Carter,

> I'm trying to simulate a large number of events, something like several
> billion. I've been doing this by running multiple jobs in parallel,
> using the ranecu engine and setting a unique initial seed for each job
> with HepRandom::setTheSeed(seed).
>
> But I've just realized that this doesn't work so well. One problem is
> that the ranecu engine uses a table of initial seeds of length 215,
> and HepRandom::setTheSeed(seed) just picks an entry in this table.
> So it's not possible to have more than 215 independent jobs running
> in parallel - I had been attempting to run 2000 jobs.
>
> Another problem seems to be that random numbers are repeating even
> within the first 215 jobs.
>
> Is there another engine I can use to get more independent random
> numbers? Are there any examples illustrating the use of other engines?

this question should have been posted in the CLHEP mailing list since
it is mainly related to the usage of the random generators defined in
CLHEP...
Anyhow, by using the static HepRandom interface for setting the single
seed, the initial seeds get retrieved, as you observed, from a table
of 255 entries which corresponds to couples of uncorrelated numbers
according to the Marsaglia algorithm.
If you need more seeds (and do not really care about perfect internal
uncorrelation), you can directly initialise your RanecuEngine with a
couple of numbers of your choice. You can do that either with:

  HepRandom::setTheSeeds(mySeeds);

or with:

  RanecuEngine* theEngine=HepRandom::getTheEngine();
  theEngine->setSeeds(mySeeds);

where 'mySeeds' is an array of 2 longs, which are the numbers you've
chosen. Other engines in CLHEP follow a similar technique, but may
require more than 2 numbers for the seeds initialisation.

Cheers, Gabriele

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

 Add Message Add Message
to: "Re: random number generation"

 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 ]