📄 random.h
字号:
// Functions for the random handling of n úm eros, genetic.// Without modifying, except for randomize to receive the seed from invocaci ón. #ifndef RANDOM_H#define RANDOM_H#include <CMath>namespace CAEP{ class CARandom { private: int seed; int jRand; double oldRand[55]; double randX2; int randCalcFlag; public: CARandom(float seed = 1); void Init(float seed); void InitNormalDeviate(float calcFlag = 1); /* Create next batch of 55 random numbers */ void AdvanceRandom(); /* Get random off and running */ void WarmUpRandom(float random_seed); /* random normal deviate after ACM algorithm 267 / Box-Muller Method */ double RandomNormalDeviate(); /* Flip a biased coin - true if heads */ int Flip(float prob); /* 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*/ float RandomPerc(); /* Pick a random integer between low and high */ int NextInt(int low, int high); /* real random number between specified limits */ float NextFloat(float lo ,float hi); /* normal noise with specified mean & std dev: mu & sigma */ double Noise(double mu,double sigma); };}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -