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.
- TUniformRandomDouble (double initialSeed)
- TUniformRandomDouble ()
Interface Category:
API.
Purpose:
- Initializes with initialSeed.
- Default constructor. Initializes with a random value.
Calling Context:
- Called to construct a TUniformRandomDouble object and initialize its seed to initialSeed.
- Called by the stream-in operators and to construct a TUniformRandomDouble object with a random seed.
Parameters:
- double initialSeed -The initial value of the seed.
- Takes no parameters.
Return Value:
None
Exceptions:
Throws a TRandomException exception if initialSeed is not in range.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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.
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.
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:
- double newSeed -The new value of the object's seed.
Return Value:
None.
Exceptions:
Throws a TRandomException exception if newSeed is not in range.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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
virtual TStream & operator <<= (TStream & fromwhere)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & fromwhere -The stream the object is streamed in from.
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.
virtual TStream & operator >>=(TStream & towhere) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & towhere -The stream the object is streamed out to.
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.