Class: TUniformRandomDouble

Declaration: RandomNumber.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TRandomDouble

Inherited By:

None.

Purpose:

Class for generating uniformly distributed double-precision random numbers.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Derived classes should override the constructors, the destructor, the member functions SetSeed, GetHighest, GetLowest, Next, and the streaming operators. Derived classes should produce uniform random generators in a different range and/or use a different pseudo-random algorithm. Additional member functions and data members may be required.

Concurrency:

Not multithread safe. Each object stores a single seed value so that different threads using the same object interleave updates to the seed. This can be an issue for some derived classes that must generate reproducible sequences of random numbers. In this case, TUniformRandomDouble objects cannot be shared by threads.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TUniformRandomDouble::TUniformRandomDouble

  1. TUniformRandomDouble (double initialSeed)
  2. TUniformRandomDouble ()

Interface Category:

API.

Purpose:

  1. Initializes with initialSeed.
  2. Default constructor. Initializes with a random value.

Calling Context:

  1. Called to construct a TUniformRandomDouble object and initialize its seed to initialSeed.
  2. Called by the stream-in operators and to construct a TUniformRandomDouble object with a random seed.

Parameters:

Return Value:

None

Exceptions:

Throws a TRandomException exception if initialSeed is not in range.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TUniformRandomDouble::~TUniformRandomDouble

virtual ~ TUniformRandomDouble ()

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:

Not multithread safe.

Other Considerations:

None.

Member Function: TUniformRandomDouble::Next

virtual double Next ()

Interface Category:

API.

Purpose:

Delivers the next double-precision number in a pseudo-random sequence and updates the state of the object.

Calling Context:

Called to deliver the next double-precision number in a pseudo-random sequence.

Parameters:

Return Value:

double -The next double-precision number in a pseudo-random sequence.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TUniformRandomDouble::GetSeed

virtual double GetSeed () const

Interface Category:

API.

Purpose:

Returns the value of the object's seed.

Calling Context:

Called to get the value of the object's seed.

Parameters:

Return Value:

double -The current value of the object's seed.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TUniformRandomDouble::SetSeed

virtual void SetSeed (double newSeed)

Interface Category:

API.

Purpose:

Changes the value of the object's seed to newSeed.

Calling Context:

Called to set the value of the object's seed to newSeed.

Parameters:

Return Value:

None.

Exceptions:

Throws a TRandomException exception if newSeed is not in range.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TUniformRandomDouble::GetLowestRandom

virtual double GetLowestRandom () const

Interface Category:

API.

Purpose:

Returns the lowest random value that the generator can return.

Calling Context:

Called to get the lowest random value that the generator can return.

Parameters:

Return Value:

double kLowestRandom -The lowest random value that the generator can return.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TUniformRandomDouble::GetHighestRandom

virtual double GetHighestRandom () const

Interface Category:

API.

Purpose:

Returns the highest random value that the generator can return.

Calling Context:

Called to get the highest random value that the generator can return.

Parameters:

Return Value:

double kHighestRandom -The highest random value that the generator can return.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None

Member Function: TUniformRandomDouble::operator<<=

virtual TStream & operator <<= (TStream & fromwhere)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TUniformRandomDouble::operator>>=

virtual TStream & operator >>=(TStream & towhere) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

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.