Class: TRandomInteger

Declaration: RandomNumber.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

TUniformRandomInteger

Purpose:

Abstract base class used for deriving integer random number generators.

Instantiation:

Abstract base class; do not instantiate.

Deriving Classes:

Derived classes must implement the constructors, the destructor and the member functions SetSeed, GetSeed, and Next. Derived classes provide random number generators with various distributions (uniform, binomial, Poison, and so on) which can use different algorithms for a given distribution. Derived classes usually require additional member functions and data members. See, for example, class TUniformRandomInteger.

Concurrency:

Multithread safe because objects cannot be instantiated. Derived classes are, in general, not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None

Member Function: TRandomInteger::~TRandomInteger

virtual ~ TRandomInteger ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe because objects cannot be instantiated. Derived classes are, in general, not multithread safe.

Other Considerations:

None.

Member Function: TRandomInteger::Next

virtual long Next ()

Interface Category:

API.

Purpose:

Generates the next number of a sequence of pseudo-random integers.

Calling Context:

Called to generate the next value in a sequence of pseudo-random integers.

Parameters:

Return Value:

long -The next value in a pseudo-random integer sequence.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe because objects cannot be instantiated. Derived classes are, in general, not multithread safe.

Other Considerations:

None.

Member Function: TRandomInteger::ARandom

static long ARandom (long lower, long upper)

Interface Category:

API.

Purpose:

Produces a pseudo-random number in the closed interval [lower, upper].

Calling Context:

Called to generate a pseudo-random number in the closed interval [lower, upper].

Parameters:

Return Value:

long -A pseudo-random number in the interval [lower, upper].

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe because objects cannot be instantiated. Derived classes are, in general, not multithread safe.

Other Considerations:

ARandom is intended for one-time use, for example, to initialize a seed value of a random number generator. Repeated use of ARandom might not yield good random sequences. ARandom might be slow -for example, it might read and transform system clock values.

Member Function: TRandomInteger::TRandomInteger

TRandomInteger ()

Interface Category:

API.

Purpose:

Default constructor, does nothing.

Calling Context:

Called by the stream-in operators.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe because objects cannot be instantiated. Derived classes are, in general, not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.