Loading...
Searching...
No Matches
RandomGenerator Class Reference

## Public Member Functions

| RandomGenerator ()
| RandomGenerator (int ss)
| ~RandomGenerator ()
int | generate ()
void | seed (int ss)

## Private Member Functions

void | seedInit (int ss)

## Private Attributes

const int | ia
const int | im
const int | iq
const int | ir
const int | deflt
int | s

## Detailed Description

Definition at line 26 of file cf_random.cc.

## Constructor & Destructor Documentation

## RandomGenerator() [1/2]

RandomGenerator::RandomGenerator | ( |  | ) |

Definition at line 41 of file cf_random.cc.

: ia(16807), im(2147483647), iq(127773), ir(2836), deflt(123459876)
{
seedInit( (int)time( 0 ) );
}
RandomGenerator::deflt
const int deflt
Definition cf_random.cc:28
RandomGenerator::ia
const int ia
Definition cf_random.cc:28
RandomGenerator::ir
const int ir
Definition cf_random.cc:28
RandomGenerator::im
const int im
Definition cf_random.cc:28
RandomGenerator::iq
const int iq
Definition cf_random.cc:28
RandomGenerator::seedInit
void seedInit(int ss)
Definition cf_random.cc:32

## RandomGenerator() [2/2]

RandomGenerator::RandomGenerator | ( | int | ss | ) |

Definition at line 46 of file cf_random.cc.

: ia(16807), im(2147483647), iq(127773), ir(2836), deflt(123459876)
{
seedInit( ss );
}

## ~RandomGenerator()

RandomGenerator::~RandomGenerator | ( |  | ) |

inline

Definition at line 36 of file cf_random.cc.

{}

## Member Function Documentation

## generate()

int RandomGenerator::generate | ( |  | ) |

Definition at line 52 of file cf_random.cc.

{
int k;
k = s/iq;
s = ia*(s-k*iq)-ir*k;
if ( s < 0 ) s += im;
return s;
}
k
int k
Definition cfEzgcd.cc:99
RandomGenerator::s
int s
Definition cf_random.cc:29

## seed()

void RandomGenerator::seed | ( | int | ss | ) |

inline

Definition at line 38 of file cf_random.cc.

{ seedInit( ss ); }

## seedInit()

void RandomGenerator::seedInit | ( | int | ss | ) |

inline private

Definition at line 32 of file cf_random.cc.

{ s = ((ss == 0) ? deflt : ss); }

## Field Documentation

## deflt

const int RandomGenerator::deflt

private

Definition at line 28 of file cf_random.cc.

## ia

const int RandomGenerator::ia

private

Definition at line 28 of file cf_random.cc.

## im

const int RandomGenerator::im

private

Definition at line 28 of file cf_random.cc.

## iq

const int RandomGenerator::iq

private

Definition at line 28 of file cf_random.cc.

## ir

const int RandomGenerator::ir

private

Definition at line 28 of file cf_random.cc.

## s

int RandomGenerator::s

private

Definition at line 29 of file cf_random.cc.

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

- factory/cf_random.cc