Go to the previous, next section.

CNMLCG -- Multiple Linear Congruence RNG

SYNOPSIS

#include <CNCL/MLCG.h>

TYPE

CN_CNMLCG

BASE CLASSES

CNRNG

DERIVED CLASSES

None

RELATED CLASSES

CNRandom

DESCRIPTION

CNMLCG is a multiple linear congruence random number generator class combining the results of two different CNLCGs.

Constructors:

CNMLCG();
CNMLCG(long seed1, long seed2);
CNMLCG(CNParam *param);
Initializes CNMLCG with two seeds, seed1 and seed2. The default constructor sets both seeds to 0.

In addition to the member functions required by CNCL, CNMLCG provides:

virtual unsigned long as_long32();
Draws a random number. The result is an unsigned integer in the range 0 ... 2^31-1.

virtual bool has_long32();
Returns FALSE because CNMLCG produces only 31bit intger values.

virtual void reset();
Resets the CNMLCG to its initial state.

void seed(unsigned long s);
Sets the two seed values, the first one to s and the second one to s + 2147483561.

void seed_internal(unsigned long, unsigned long);
Sets both seed values.

Go to the previous, next section.