PseudoRandomSource Class Reference

this class serves as a source of reproducible (pseudo-)random numbers More...

#include <PseudoRandomSource.h>

List of all members.

Public Member Functions

 PseudoRandomSource (UWORD32 s)
UWORD32 getValue (UWORD32 n)

Private Attributes

UWORD32 Value

Static Private Attributes

static const UWORD32 A = 1367208549
static const UWORD32 C = 1

Detailed Description

To generate the random numbers, the linear congruetial method is used. 2^32 is used as modulus. The overflow in the implementation is intended (and controlled, as UWORD32 is used as datatype which always is 32 bits wide).


Constructor & Destructor Documentation

PseudoRandomSource::PseudoRandomSource ( UWORD32  s  )  [inline]

construct a PseudoRandomSource object

Parameters:
s the seed

Member Function Documentation

UWORD32 PseudoRandomSource::getValue ( UWORD32  n  ) 

get a pseudo-random value from {0,...,n-1}

Parameters:
n the range of the random value to be returned
Returns:
a number >= 0 and <= n - 1

After calling getValue, the next getValue call will use the next state of the random number generator (analogous to the C rand() function)


Member Data Documentation

const UWORD32 PseudoRandomSource::A = 1367208549 [static, private]
const UWORD32 PseudoRandomSource::C = 1 [static, private]

The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2