Simbody
3.7

This class defines the interface for pseudorandom number generators. More...
Classes  
class  Gaussian 
This is a subclass of Random that generates numbers according to a Gaussian distribution with a specified mean and standard deviation. More...  
class  Uniform 
This is a subclass of Random that generates numbers uniformly distributed within a specified range. More...  
Public Member Functions  
~Random ()  
void  setSeed (int seed) 
Reinitialize this random number generator with a new seed value. More...  
Real  getValue () const 
Get the next value in the pseudorandom sequence. More...  
void  fillArray (Real array[], int length) const 
Fill an array with values from the pseudorandom sequence. More...  
Protected Member Functions  
Random ()  
This constructor should never be invoked directly. More...  
RandomImpl &  getImpl () 
Get the internal object which implements the random number generator. More...  
const RandomImpl &  getConstImpl () const 
Get a constant reference to the internal object which implements the random number generator. More...  
Protected Attributes  
RandomImpl *  impl 
This class defines the interface for pseudorandom number generators.
Subclasses generate numbers according to specific distributions. Currently, there are two such subclasses: Random::Uniform and Random::Gaussian. For example, to generate a series of pseudorandom numbers uniformly distributed between 0 and 100, you would call:
Random::Uniform random(0.0, 100.0); Real nextValue = random.getValue(); // Each time you call this, it will return a different value.
Although the numbers are distributed in a seemingly random way, they are nonetheless deterministic, so you can create several random number generators that each returns exactly the same sequence of numbers. The sequence is determined by the seed value with which the Random object is initialized. By default, a different seed is used for every object. You can invoke setSeed(int seed) on a Random object to explicitly specify the seed to use. Each seed value corresponds to a different sequence of numbers that is uncorrelated with all others.
This class is implemented using the SIMDoriented Fast Mersenne Twister (SFMT) library. It provides good performance, excellent statistical properties, and a very long period.
The methods of this class do not provide any synchronization or other mechanism to ensure thread safety. It is therefore important that a single Random object not be accessed from multiple threads. One minor concession to threads: even if you don't set the seed explicitly, each thread's Random object will use a different seed so you'll get a unique series of numbers in each thread.
SimTK::Random::~Random  (  ) 

protected 
This constructor should never be invoked directly.
Instead, create an instance of one of the subclasses.
void SimTK::Random::setSeed  (  int  seed  ) 
Reinitialize this random number generator with a new seed value.
Real SimTK::Random::getValue  (  )  const 
Get the next value in the pseudorandom sequence.
void SimTK::Random::fillArray  (  Real  array[], 
int  length  
)  const 
Fill an array with values from the pseudorandom sequence.

protected 
Get the internal object which implements the random number generator.

protected 
Get a constant reference to the internal object which implements the random number generator.

protected 