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


CNFileG -- Data File RNG

SYNOPSIS

#include <CNCL/FileG.h>

TYPE

CN_FILEG

BASE CLASSES

CNRNG

DERIVED CLASSES

None

RELATED CLASSES

CNRandom

DESCRIPTION

CNFileG is a data file random number generator class. It reads random numbers from a disk file, e.g. data from PURAN2. Thus the quality of this generator class depends on the quality of the data files. Truely random numbers can be generated if a good file is supplied. Here the problem of this class can be seen. A good file must have a sufficient size. Huge memory use and low speed can be expected when using this class.

Constructors:

CNFileG(char *filename, bool par = FALSE);
CNFileG(CNParam *param);
Initializes CNFileG with data file filename and sets parity check if required, e.g. parity check for PURAN2.

In addition to the member functions required by CNCL, CNFileG 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 the CNFileG is able to produce 32bit integer values.
virtual void reset();
Resets the CNFileG to its initial state.
void newfile(char *filename, bool par = FALSE);
Opens a new file for reading random number data and indicates if data requires parity check.
unsigned int wrong_parity();
Gets the number of wrong parity checks while reading data from a file, e.g. data from PURAN2.


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