Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members

Random Class Reference

#include <Random.h>

List of all members.

Public Member Functions

 Random ()
 Constructor.

 ~Random ()
 Destructor.

void warmup_random (float)
 Get random off and running.

float rndreal (float, float)
 Real random number between specified limits.

int rnd (int, int)
 Pick a random integer between low and high.

float randomperc ()
 Fetch a single random number between 0.0 and 1.0.

double randomnormaldeviate ()
 Random normal deviate after ACM algorithm 267 / Box-Muller Method.

void randomize ()
 Initialize random numbers batch.

double noise (double, double)
 Normal noise with specified mean & std dev: mu & sigma.

void initrandomnormaldeviate ()
int flip (float)
 Flip a biased coin - true if heads.

void advance_random ()
 advance_random

double randreal2 (void)
 randreal2

double Gauss (double sigma)
 Gauss distribution.

double N (double m, double sigma)
 N.

void initrandom (int seed)
 Initialize the random seed.

int randint (int lo, int hi)

Public Attributes

int Seed
int isinit
float Rseed
 Random numbers seed.

double oldrand [55]
 Array of 55 random numbers.

int jrand
 Current random number.

double rndx2
 Variable used with random normal deviate.

int rndcalcflag
 Variable used with random normal deviate.


Constructor & Destructor Documentation

Random::Random  ) 
 

Constructor of the class

Definition at line 26 of file Random.cpp.

References isinit, and Seed.

Random::~Random  ) 
 

Destructor of the class

Definition at line 36 of file Random.cpp.


Member Function Documentation

void Random::advance_random  ) 
 

Definition at line 56 of file Random.cpp.

References oldrand.

Referenced by randomperc(), and warmup_random().

int Random::flip float  prob  ) 
 

Parameters:
prob The biased probability

Definition at line 43 of file Random.cpp.

References randomperc().

Referenced by BinaryRealGene::bitFlipMutation(), BinaryGrayRealGene::bitFlipMutation(), and BinaryGene::bitFlipMutation().

double Random::Gauss double  sigma  ) 
 

Parameters:
sigma The standard deviation
Returns:
A Gauss distribution value

Definition at line 248 of file Random.cpp.

References Uniform.

Referenced by N().

void Random::initrandom int  seed  ) 
 

Parameters:
seed The random seed

Definition at line 334 of file Random.cpp.

References Seed.

Referenced by Paes::Paes().

void Random::initrandomnormaldeviate  ) 
 

Initialization routine for randomnormaldeviate

Definition at line 80 of file Random.cpp.

References rndcalcflag.

double Random::N double  m,
double  sigma
 

Definition at line 325 of file Random.cpp.

References Gauss().

double Random::noise double  mu,
double  sigma
 

Parameters:
mu The mean of the distribution
sigma The standard deviation of the distribution

Definition at line 90 of file Random.cpp.

References randomnormaldeviate().

int Random::randint int  lo,
int  hi
 

Definition at line 340 of file Random.cpp.

References randreal2().

void Random::randomize  ) 
 

Definition at line 99 of file Random.cpp.

References jrand, oldrand, Rseed, and warmup_random().

Referenced by Paes::Paes().

double Random::randomnormaldeviate  ) 
 

Definition at line 115 of file Random.cpp.

References randomperc(), rndcalcflag, and rndx2.

Referenced by noise().

float Random::randomperc  ) 
 

Fetch a single random number between 0.0 and 1.0 - Subtractive Method See Knuth, D. (1969), v. 2 for details name changed from random() to avoid library conflicts on some machines

Definition at line 147 of file Random.cpp.

References advance_random(), jrand, and oldrand.

Referenced by flip(), randomnormaldeviate(), rnd(), and rndreal().

double Random::randreal2 void   ) 
 

Definition at line 229 of file Random.cpp.

References isinit, and Seed.

Referenced by Paes::Paes(), and randint().

int Random::rnd int  low,
int  high
 

Definition at line 166 of file Random.cpp.

References randomperc().

Referenced by BinaryGene::BinaryGene(), BinaryGrayRealGene::BinaryGrayRealGene(), and BinaryRealGene::BinaryRealGene().

float Random::rndreal float  lo,
float  hi
 

Definition at line 189 of file Random.cpp.

References randomperc().

Referenced by BinaryGrayRealGene::BinaryGrayRealGene(), BinaryGrayRealGene::bitFlipMutation(), RealGene::polynomialMutation(), RealGene::randomMutation(), RealGene::RealGene(), and RealGene::uniformMutation().

void Random::warmup_random float  random_seed  ) 
 

Definition at line 198 of file Random.cpp.

References advance_random(), jrand, and oldrand.

Referenced by randomize().


Member Data Documentation

int Random::isinit
 

Definition at line 23 of file Random.h.

Referenced by Random(), and randreal2().

int Random::jrand
 

Definition at line 27 of file Random.h.

Referenced by randomize(), randomperc(), and warmup_random().

double Random::oldrand[55]
 

Definition at line 26 of file Random.h.

Referenced by advance_random(), randomize(), randomperc(), and warmup_random().

int Random::rndcalcflag
 

Definition at line 29 of file Random.h.

Referenced by initrandomnormaldeviate(), and randomnormaldeviate().

double Random::rndx2
 

Definition at line 28 of file Random.h.

Referenced by randomnormaldeviate().

float Random::Rseed
 

Definition at line 25 of file Random.h.

Referenced by Paes::Paes(), and randomize().

int Random::Seed
 

Definition at line 22 of file Random.h.

Referenced by initrandom(), Random(), and randreal2().


The documentation for this class was generated from the following files:
Generated on Wed Feb 11 10:38:04 2004 for Paes by doxygen 1.3.3