copasi API  0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
CRandom Class Reference

#include <CRandom.h>

Inheritance diagram for CRandom:
Cmt19937 Cr250 Cmt19937HR

List of all members.

Classes

struct  ExpVars
struct  PoissonVars

Public Types

enum  Type { r250 = 0, mt19937, mt19937HR }

Public Member Functions

virtual ~CRandom ()
const CRandom::TypegetType () const
const unsigned C_INT32 & getModulus () const
virtual void initialize (unsigned C_INT32 seed=CRandom::getSystemSeed())
virtual unsigned C_INT32 getRandomU ()
virtual C_INT32 getRandomS ()
virtual unsigned C_INT32 getRandomU (const unsigned C_INT32 &max)
virtual C_INT32 getRandomS (const C_INT32 &max)
virtual C_FLOAT64 getRandomCC ()
virtual C_FLOAT64 getRandomCO ()
virtual C_FLOAT64 getRandomOO ()
virtual C_FLOAT64 getRandomNormal01 ()
virtual C_FLOAT64 getRandomNormal (const C_FLOAT64 &mean, const C_FLOAT64 &sd)
virtual C_FLOAT64 getRandomNormalPositive (const C_FLOAT64 &mean, const C_FLOAT64 &sd)
virtual C_FLOAT64 getRandomNormalLog (const C_FLOAT64 &mean, const C_FLOAT64 &sd)
virtual C_FLOAT64 getRandomPoisson (const C_FLOAT64 &mean)
virtual C_FLOAT64 getRandomExp ()

Static Public Member Functions

static unsigned C_INT32 getSystemSeed ()
static CRandomcreateGenerator (CRandom::Type type=CRandom::mt19937, unsigned C_INT32 seed=0)

Static Public Attributes

static const std::string TypeName []
static const char * XMLType []

Protected Member Functions

 CRandom ()
void setModulus (const unsigned C_INT32 &modulus)

Protected Attributes

unsigned C_INT32 mNumberU
C_INT32 mNumberS
C_FLOAT64 mFloat
CRandom::Type mType
unsigned C_INT32 mModulus
C_FLOAT64 mModulusInv
C_FLOAT64 mModulusInv1

Member Enumeration Documentation

Enumerator:
r250 
mt19937 
mt19937HR 

Constructor & Destructor Documentation

CRandom::CRandom ( ) [protected]

Default/Named constructor. Seeds the random number generator with the given seed.

CRandom::~CRandom ( ) [virtual]

The destructor.


Member Function Documentation

CRandom * CRandom::createGenerator ( CRandom::Type  type = CRandom::mt19937,
unsigned C_INT32  seed = 0 
) [static]

Create a Generator. Note: the returned object has to be released after use with delete

Parameters:
CRandom::Typetype (default Mersenne Twister)
constC_INT32 & seed (default system generated seed)
Returns:
CRandom * randomGenerator
const unsigned C_INT32 & CRandom::getModulus ( ) const

Retreive the method dependend modulus

Returns:
const unsigned C_INT32 & modulus
C_FLOAT64 CRandom::getRandomCC ( ) [virtual]

Produces a uniformly distributed random number in 0 <= x <= 1.

Returns:
C_FLOAT64 random

Reimplemented in Cmt19937HR, Cmt19937, and Cr250.

C_FLOAT64 CRandom::getRandomCO ( ) [virtual]

Produces a uniformly distributed random number in 0 <= x < 1. Note: 0 < x <= 1 may be achieved by 1.0 - getRandomCO().

Returns:
C_FLOAT64 random

Reimplemented in Cmt19937HR, Cmt19937, and Cr250.

C_FLOAT64 CRandom::getRandomExp ( ) [virtual]
C_FLOAT64 CRandom::getRandomNormal ( const C_FLOAT64 &  mean,
const C_FLOAT64 &  sd 
) [virtual]

Produces a Normally distributed random number with Mean=mean and SD=sd

Parameters:
constC_FLOAT64 & mean
constC_FLOAT64 & sd
Returns:
C_FLOAT64 random
C_FLOAT64 CRandom::getRandomNormal01 ( ) [virtual]

Produces a Normally distributed random number with mean=0 and SD=1

Returns:
C_FLOAT64 random
C_FLOAT64 CRandom::getRandomNormalLog ( const C_FLOAT64 &  mean,
const C_FLOAT64 &  sd 
) [virtual]

Produces a Normally distributed random number with Mean=mean and SD=sd in Logarithmic scale

Returns:
C_FLOAT64 random
C_FLOAT64 CRandom::getRandomNormalPositive ( const C_FLOAT64 &  mean,
const C_FLOAT64 &  sd 
) [virtual]

Produces a Strictly Positive Normally distributed random number with Mean=mean and SD=sd

Parameters:
constC_FLOAT64 & mean
constC_FLOAT64 & sd
Returns:
C_FLOAT64 random
C_FLOAT64 CRandom::getRandomOO ( ) [virtual]

Produces a uniformly distributed random number in 0 < x < 1.

Returns:
C_FLOAT64 random

Reimplemented in Cmt19937HR, Cmt19937, and Cr250.

C_FLOAT64 CRandom::getRandomPoisson ( const C_FLOAT64 &  mean) [virtual]

Produces a Poisson distributed random number with Mean=mean

Parameters:
constC_FLOAT64 & mean
Returns:
C_FLOAT64 random
C_INT32 CRandom::getRandomS ( ) [virtual]

Get a random number in 0 <= n <= (Modulus & 0x7ffffff)

Returns:
C_INT32 random

Reimplemented in Cmt19937, and Cr250.

C_INT32 CRandom::getRandomS ( const C_INT32 &  max) [virtual]

Get a random number in 0 <= n <= max Note: max must be smaller than Modulus (no check for performance)

Parameters:
constC_INT32 & max
Returns:
C_INT32 random
unsigned C_INT32 CRandom::getRandomU ( ) [virtual]

Get a random number in 0 <= n <= Modulus

Returns:
unsigned C_INT32 random

Reimplemented in Cmt19937, and Cr250.

unsigned C_INT32 CRandom::getRandomU ( const unsigned C_INT32 &  max) [virtual]

Get a random number in 0 <= n <= max Note: max must be smaller than Modulus (no check for performance)

Parameters:
constunsigned C_INT32 & max
Returns:
unsigned C_INT32 random
unsigned C_INT32 CRandom::getSystemSeed ( ) [static]

get a system dependend seed (hopefully random)

const CRandom::Type & CRandom::getType ( ) const

Retreive the type of the generator

Returns:
const CRandom::Type & type
virtual void CRandom::initialize ( unsigned C_INT32  seed = CRandom::getSystemSeed()) [virtual]

Initialize or reinitialize the random number generator with the given seed.

Parameters:
unsignedC_INT32 seed (default system seed)

Reimplemented in Cmt19937, and Cr250.

void CRandom::setModulus ( const unsigned C_INT32 &  modulus) [protected]

Set the Modulus

Parameters:

Member Data Documentation

C_FLOAT64 CRandom::mFloat [protected]

A 64-bit floating point random number.

unsigned C_INT32 CRandom::mModulus [protected]
C_FLOAT64 CRandom::mModulusInv [protected]
C_FLOAT64 CRandom::mModulusInv1 [protected]
C_INT32 CRandom::mNumberS [protected]

A singned 32-bit integer random number.

unsigned C_INT32 CRandom::mNumberU [protected]

A unsigned 32-bit integer random number.

The type of the generator

const std::string CRandom::TypeName [static]
Initial value:
{
  "r250",
  "Mersenne Twister",
  "Mersenne Twister (HR)",
  ""
}

String literals for the GUI to display type names of random number generators known to COPASI.

const char * CRandom::XMLType [static]
Initial value:
{
  "r250",
  "MersenneTwister",
  "MersenneTwisterHR",
  NULL
}

XML type names of random number generators known to COPASI.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines