Random< IntegralType > Class Template Reference

#include <Random.h>

List of all members.

Public Types

typedef IntegralType int_type
 a shortcut for the type of generated 'random' numbers

Public Member Functions

 Random (int_type seed=int_type(0))
 ~Random ()
void reset (int_type seed)
int_type randMax () const
int_type nextInt ()


Detailed Description

template<class IntegralType>
class Random< IntegralType >

A random number generator. It can generate pseudo random sequences of an integral type that is given as template parameter. It uses a Park-Miller simple generator combined with a shuffle table.

Definition at line 23 of file Random.h.


Constructor & Destructor Documentation

template<class IntegralType>
Random< IntegralType >::Random ( int_type  seed = int_type(0)  )  [inline]

Constructor. Initializes the random number generator.

Parameters:
seed is used to generate other pseudo-random values based on this initial value
Remarks:
If the seed provided is equal to zero (or not provided at all), the generator is initialized using the current time.

Definition at line 36 of file Random.h.

References Random< IntegralType >::reset().

Here is the call graph for this function:

template<class IntegralType>
Random< IntegralType >::~Random (  )  [inline]

Destructor

Definition at line 43 of file Random.h.


Member Function Documentation

template<class IntegralType>
void Random< IntegralType >::reset ( int_type  seed  )  [inline]

Re-initialize the random number generator with a given seed

Parameters:
seed is used to generate other pseudo-random values based on this initial value
Remarks:
After resetting the generator with a given seed, the generated sequence of numbers will always be the same.

Definition at line 53 of file Random.h.

References Random< IntegralType >::randMax().

Referenced by Random< IntegralType >::Random().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class IntegralType>
int_type Random< IntegralType >::randMax (  )  const [inline]

Get the maximum integer that can be generated.

Returns:
One plus the maximum value that can be generated
Remarks:
The generator will generate pseudo random numbers in the range [0,randMax()) (upper bound is excluded).

Definition at line 108 of file Random.h.

Referenced by Random< IntegralType >::nextInt(), and Random< IntegralType >::reset().

Here is the caller graph for this function:

template<class IntegralType>
int_type Random< IntegralType >::nextInt (  )  [inline]

Generate a (the next) pseudo random integer.

Returns:
A pseudo random value in the range [0,randMax())

Definition at line 123 of file Random.h.

References Random< IntegralType >::randMax().

Here is the call graph for this function:


The documentation for this class was generated from the following file:
Math-Objects Library Docs  Generated by: doxygen