COPASI API  4.40.278
Cr250 Class Reference

#include <Cr250.h>

Inheritance diagram for Cr250:
[legend]

Public Member Functions

C_FLOAT64 getRandomCC ()
 
C_FLOAT64 getRandomCO ()
 
C_FLOAT64 getRandomOO ()
 
C_INT32 getRandomS ()
 
unsigned C_INT32 getRandomU ()
 
void initialize (unsigned C_INT32 seed=CRandom::getSystemSeed())
 
 ~Cr250 ()
 
- Public Member Functions inherited from CRandom
CRandomcopy ()
 
const unsigned C_INT32getModulus () const
 
virtual C_FLOAT64 getRandomExp ()
 
virtual C_FLOAT64 getRandomGamma (C_FLOAT64 shape, C_FLOAT64 scale)
 
virtual C_FLOAT64 getRandomNormal (const C_FLOAT64 &mean, const C_FLOAT64 &sd)
 
virtual C_FLOAT64 getRandomNormal01 ()
 
virtual C_FLOAT64 getRandomNormalLog (const C_FLOAT64 &mean, const C_FLOAT64 &sd)
 
virtual C_FLOAT64 getRandomNormalPositive (const C_FLOAT64 &mean, const C_FLOAT64 &sd)
 
virtual C_FLOAT64 getRandomPoisson (const C_FLOAT64 &mean)
 
virtual C_INT32 getRandomS (const C_INT32 &max)
 
virtual C_FLOAT64 getRandomStdGamma (C_FLOAT64 shape)
 
virtual unsigned C_INT32 getRandomU (const unsigned C_INT32 &max)
 
const CRandom::TypegetType () const
 
virtual ~CRandom ()
 

Private Member Functions

 Cr250 (unsigned C_INT32 seed)
 
C_FLOAT64 dr250 (void)
 
unsigned C_INT16 myrand ()
 
unsigned C_INT32 r250 (void)
 
unsigned C_INT32 r250n (const unsigned C_INT16 &max)
 

Private Attributes

unsigned C_INT16 mBuffer [250]
 
C_INT32 mIndex
 
unsigned C_INT32 mSeed
 

Friends

CRandomCRandom::createGenerator (CRandom::Type type, unsigned C_INT32 seed)
 

Additional Inherited Members

- Public Types inherited from CRandom
enum  Type { r250 = 0 , mt19937 , mt19937HR , unkown }
 
- Static Public Member Functions inherited from CRandom
static CRandomcreateGenerator (CRandom::Type type=CRandom::mt19937, unsigned C_INT32 seed=0)
 
static unsigned C_INT32 getSystemSeed ()
 
- Static Public Attributes inherited from CRandom
static const std::string TypeName []
 
static const char * XMLType []
 
- Protected Member Functions inherited from CRandom
 CRandom ()
 
void setModulus (const unsigned C_INT32 &modulus)
 
- Protected Attributes inherited from CRandom
C_FLOAT64 mFloat
 
unsigned C_INT32 mModulus
 
C_FLOAT64 mModulusInv
 
C_FLOAT64 mModulusInv1
 
C_INT32 mNumberS
 
unsigned C_INT32 mNumberU
 
CRandom::Type mType
 

Detailed Description

Cr250 class implementing the R250 random number generator, by W. L. Maier

Created for Copasi by Stefan Hoops (C) Stefan Hoops 2002

Constructor & Destructor Documentation

◆ Cr250()

Cr250::Cr250 ( unsigned C_INT32  seed)
private

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

Parameters
C_INT32seed

References initialize(), and CRandom::setModulus().

◆ ~Cr250()

Cr250::~Cr250 ( )

The destructor.

Member Function Documentation

◆ dr250()

C_FLOAT64 Cr250::dr250 ( void  )
private

Number returned by dr250() is in range [0,1)

Returns
C_FLOAT64 random

References CRandom::mNumberU, and r250().

Referenced by getRandomCO().

◆ getRandomCC()

C_FLOAT64 Cr250::getRandomCC ( )
virtual

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

Returns
C_FLOAT64 random

Reimplemented from CRandom.

References CRandom::mModulusInv, and r250().

◆ getRandomCO()

C_FLOAT64 Cr250::getRandomCO ( )
virtual

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

Returns
const C_FLOAT64 & random

Reimplemented from CRandom.

References dr250().

◆ getRandomOO()

C_FLOAT64 Cr250::getRandomOO ( )
virtual

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

Returns
const C_FLOAT64 & random

Reimplemented from CRandom.

References CRandom::mModulusInv1, and r250().

◆ getRandomS()

C_INT32 Cr250::getRandomS ( )
virtual

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

Returns
C_INT32 random

Reimplemented from CRandom.

References r250().

◆ getRandomU()

unsigned C_INT32 Cr250::getRandomU ( )
virtual

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

Returns
unsigned C_INT32 random

Reimplemented from CRandom.

References r250().

◆ initialize()

void Cr250::initialize ( unsigned C_INT32  seed = CRandom::getSystemSeed())
virtual

Initialize or reinitialize the random number generator with the given seed. Note: seed = 12345 gives the default initilization as in W. L. Maier code

Parameters
unsignedC_INT32 seed (default system seed)

Reimplemented from CRandom.

References mBuffer, mIndex, mSeed, and myrand().

Referenced by Cr250().

◆ myrand()

unsigned C_INT16 Cr250::myrand ( )
private

Linear congruent pseudorandom number generator for initialization. Return a pseudorandom number in the interval 0 <= n <= 32767.

References mSeed.

Referenced by initialize().

◆ r250()

unsigned C_INT32 Cr250::r250 ( void  )
private

Number returned by r250() is in the interval 0 <= k <= 65535.

Returns
unsigned C_INT32 random

References C_INT16, mBuffer, mIndex, and CRandom::mNumberU.

Referenced by dr250(), getRandomCC(), getRandomOO(), getRandomS(), getRandomU(), and r250n().

◆ r250n()

unsigned C_INT32 Cr250::r250n ( const unsigned C_INT16 max)
private

Number returned by r250() is in the interval 0 <= k < max.

Parameters
unsignedC_INT16 max
Returns
unsigned C_INT32 random

References C_INT16, max, CRandom::mNumberU, and r250().

Friends And Related Function Documentation

◆ CRandom::createGenerator

CRandom* CRandom::createGenerator ( CRandom::Type  type,
unsigned C_INT32  seed 
)
friend

Member Data Documentation

◆ mBuffer

unsigned C_INT16 Cr250::mBuffer[250]
private

Referenced by initialize(), and r250().

◆ mIndex

C_INT32 Cr250::mIndex
private

Referenced by initialize(), and r250().

◆ mSeed

unsigned C_INT32 Cr250::mSeed
private

Referenced by initialize(), and myrand().


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