Go to the previous, next section.

CNFiboG -- Fibonacci RNG

SYNOPSIS

#include <CNCL/FiboG.h>

TYPE

CN_FIBOG

BASE CLASSES

CNRNG

DERIVED CLASSES

None

RELATED CLASSES

CNRandom

DESCRIPTION

CNFiboG is the Fibonacci random number generator class.

The main advantage of this method can be seen in a combination of a simple mathematical formula and a period length sufficient enough for physical simulation runs. Nevertheless, it still represents a pseudo random number generator. Thus a non-ideal correlation can be expected.

Constructors:

CNFiboG(CNParam *param);
CNFiboG(unsigned long init = 54217137);
Initializes CNFiboG with a 97 elements circular queue and initial seed.

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

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

virtual bool has_long32();
Returns TRUE because CNFiboG is able to produce 32bit integer values.

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

void seed_internal(unsigned long *ulp);
Reinitializes the circular queue and cn with *ulp, an array of 98 values.

Go to the previous, next section.