WWC snapshot of http://www.alw.nih.gov/Docs/NIHCL/nihcl_39.html taken on Sat Jun 10 19:13:57 1995

Go to the previous, next section.

Random--Random Number Generator

SYNOPSIS

#include <nihcl/Random.h>

BASE CLASS

Object

DERIVED CLASSES

None

RELATED CLASSES

None

DESCRIPTION

Class Random provides a pseudo-random number generator. The member function next() returns random float numbers uniformly distributed over the interval (0.0,1.0).

Reference:

Pierre L'ecuyer, "Efficient and Portable Combined Random Number Generators", Commun. ACM 31, 6 (June 1988), 742-749.

CONSTRUCTORS

Random()
Creates an instance of class Random with seed1 = seconds elapsed since 00:00:00 GMT, Jan. 1, 1970, and seed2 = the address of this instance.

Random(long seed1, long seed2)
Creates an instance of class Random with seed1 and seed2 set from the arguments.

ACCESSING RANDOM NUMBER GENERATORS

float next()
The function next() returns random float numbers uniformly distributed over the interval (0.0,1.0).

SEARCHING

virtual unsigned hash() const
Returns the address of this Random.

TESTING RANDOM NUMBER GENERATORS

virtual bool isEqual(const Object& ob) const
Returns YES if this Random and ob are the same; i.e., reside at the same memory address.

COPYING RANDOM NUMBER GENERATORS

virtual void deepenShallowCopy()
This function is a no-op for class Random.

READING, PRINTING RANDOM NUMBER GENERATORS

virtual void printOn(ostream& strm =cout) const
Prints seed1 and seed2 of this instance of class Random on the output stream strm.

PROTECTED MEMBERS

Object I/O

virtual void storer(OIOofd& fd) const
virtual void storer(OIOout& strm) const
Stores this instance of class Random on fd or strm.

DISABLED MEMBER FUNCTIONS

virtual int compare(const Object& ob) const
These functions are implemented as shouldNotImplement().

EXCEPTIONS RAISED

None

Go to the previous, next section.