In order to reproduce the stochastic processes in the system (e.g., arrival
processes, service processes) using events it is necessary to generate random
variables for time stamps according to a pre-defined distribution function,
possibly taking the system state into consideration. The simulation library
offers a number of distributions.
Generating Random Numbers
The generation of random variables from a
distribution function is based on the generation of pseudo-random number
sequences with a large period following a uniform distribution between 0 and
1.
Some classes have been derived from
RandomNumberGenerator
that serve as random number
generators. In most cases they override the index operator
operator()
and return a random number between 0 and 1:
StdRandomNumberGenerator
is a relatively simple but
generally sufficient generator [1]. A global instance
SYSTEM_RNG
of
this type is generated that is used as the default random number generator
for the system.
Random variables needed for the simulation are generated based on these
random numbers and a specific distribution function (e.g., for random service
times or arrival intervals). The distribution function must be inverted (Fig.
1), which in some cases can be done exactly, in other cases only
approximately [2]. The task of inversion is executed by the distribution
classes.
Creating a random number according to a certain distribution
Structure and Interface of Distribution Classes
All distribution
classes are derived from the class
Distribution
, which has the following
characteristics:
a final reference
rng
to the its random number generator, which will
by default be initialized with a reference to the system default random
number generator (see
ikr.simlib.random
)
Basically, discrete and continuous distributions are treated differently.
They are represented by the classes
DiscreteDistribution
and
ContinuousDistribution
, which
have been derived from
Distribution
.
[1] S. K. PARK, K. W. MILLER:
"Random number generators: good ones are hard to find." Communications of the
ACM, pp. 1192-1201, Oct. 1988.
[2] A. M. LAW, W. D. KELTON: Simulation Modeling & Analysis, 2nd edition,
McGraw- Hill, 1991