Next: CONS001 Introduction to
Up: GEANT
Previous: BASE410 Utility Routines
Routine ID: BASE420
| Author(s): | Submitted: 27.07.93
|
Origin: R.Brun, F.Carminati | Revised: 14.12.93
|
CALL GRNDM (VEC*,LEN)
- VEC
- ( REAL) vector containing the generated random number;
- LEN
- ( INTEGER) number of random numbers to generate.
GRNDM generates a sequence of uniformly distributed random numbers in the
interval (0,1). The numbers are returned in a vector.
The code is a copy
of the CERN Program Library routine RANECU [,]
(entry V114).
Several independent sequences can be defined and used. Each sequence must
be initialised by the user, otherwise the result is unpredictable.
Two integer seeds are used to initialise a sequence. Not all pairs of
integers define a good random sequence or one which is independent from
others. Sections of the same random sequence can be defined as independent
sequences. The period of the generator is
.
A generation has
been performed in order to provide the seeds to start any of the generated
sections. There are 215 possible seed pairs and they are all
numbers
apart. Thus a sequence started from one of the seed pairs, after
numbers will start generating the next one.
CALL GRNDMQ (ISEED1,ISEED2,ISEQ,CHOPT)
- ISEED1
- ( INTEGER) first seed of the sequence;
- ISEED2
- ( INTEGER) second seed of the sequence;
- ISEQ
- ( INTEGER) number of the independent
sequence of random numbers referred to by this call. If
ISEQ
0, then the last valid sequence used will be addressed
either for a save or a store. In case the option 'G' is
specified, on output the variable will contain the sequence
actually used;
- CHOPT
- ( CHARACTER*(*)) the action to be taken:
- ' '
- if 1
ISEQ
215, sequence number ISEQ will be
initialised with the seeds of the pre-computed
independent sequence ISEQ.
If ISEQ
0 or ISEQ>215, sequence number 1 will be
initialised with the default seeds. ISEED1 and ISEED2 are
ignored;
- 'G'
- get the present status of the generator: the two integer
seeds ISEED1 and ISEED2 will be returned for sequence
ISEQ;
- 'S'
- set the status of the generator.
The two integer seeds ISEED1 and ISEED2 will be
used to restart the generator for sequence ISEQ.
- 'SH'
- the same action as for 'S' and store the two
integer seeds ISEED1 and ISEED2 in the event header bank.
- 'Q'
- Get the pre-generated seeds for ISEQ
(1
ISEQ
215).
There are 215 pre-generated sequences each one will
generate
numbers before reproducing the following
one.
Initialises the random number generator.
GARNDMVALUE = GARNDM(DUMMY)
- DUMMY
- ( REAL) dummy parameter, ignored;
Returns a random number r distributed as
.
where
is a random number extracted by GRNDM.
CALL GPOISS (AMVEC,NPVEC*,LEN)
- AMVEC
- ( REAL) array of length LEN containing the average
values of the Poisson distributions requested;
- NPVEC
- ( INTEGER) array of length LEN containing the random
numbers: NPVEC(I) is a random number with a Poisson distribution of
average AMVEC(I);
- LEN
- ( INTEGER) number of random numbers requested.
This routine extracts integer random numbers according to the
Poisson distribution. Given a Poisson distribution of average
and r uniformly distributed between 0 and 1, the method used is the
following:
- let
, N=0 and S=P;
- if
accept N;
- let N=N+1,
, S=S+P and go back to 2;
If
, a gaussian distribution with average
and
is generated.
F.Bruyant
CONS001
Next: CONS001 Introduction to
Up: GEANT
Previous: BASE410 Utility Routines
Janne Saarela
Mon Apr 3 12:46:29 METDST 1995