Go to the first, previous, next, last section, table of contents.


CNRNG -- Abstract Random Number Generator Base Class

SYNOPSIS

#include <CNCL/RNG.h>

TYPE

CN_RNG

BASE CLASSES

CNObject

DERIVED CLASSES

CNACG, CNFiboG, CNFileG, CNLCG, CNMLCG, CNTausG

RELATED CLASSES

CNRandom

DESCRIPTION

CNRNG is the abstract base class for all CNCL random number generators. It defines the common interface.

Constructors:

CNRNG();
CNRNG(CNParam *param);
Initializes CNRNG.

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

unsigned long as_long();
This function returns an unsigned integer in the range 0 ... 2^31-1. It uses the as_long32() function from the actual CNRNG to draw a random number and truncates it down to 31bit.
virtual unsigned long as_long32() = 0;
This function is used to draw a random number from the actual CNRNG (derived from the CNRNG class). The result is an unsigned integer in the range 0 ... 2^32-1 provided the class is able to produce 32bit random numbers.
virtual bool has_long32() = 0;
This function tells whether the actual CNRNG is able to produce 32bit integer values or not.
virtual void reset() = 0;
Resets the CNRNG to its initial state.
float as_float();
double as_double();
These functions draw a random number in the range 0 ... 1 and return the result as a float or double value.
virtual void seed(unsigned long s);
This method for all RNG's only draws s as_long32() numbers.


Go to the first, previous, next, last section, table of contents.