📄 randomc.h
字号:
/***************************** RANDOMC.H *********************** 2001-10-24 AF *** This file contains class declarations for the C++ library of uniform* random number generators.** Overview of classes:* ====================** class TRandomMersenne:* Random number generator of type Mersenne twister.* Source file mersenne.cpp** class TRandomMotherOfAll:* Random number generator of type Mother-of-All (Multiply with carry).* Source file mother.cpp** class TRanrotBGenerator:* Random number generator of type RANROT-B.* Source file ranrotb.cpp** class TRanrotWGenerator:* Random number generator of type RANROT-W.* Source file ranrotw.cpp** class TRandomMotRot:* Combination of Mother-of-All and RANROT-W generators.* Source file ranmoro.cpp and motrot.asm.* Coded in assembly language for improved speed.* Must link in RANDOMAO.LIB or RANDOMAM.LIB.*** Member functions (methods):* ===========================** All these classes have identical member functions:** Constructor(uint32 seed):* The seed can be any integer. Usually the time is used as seed.* Executing a program twice with the same seed will give the same sequence of* random numbers. A different seed will give a different sequence.** void RandomInit(uint32 seed);* Re-initializes the random number generator with a new seed.** void RandomInitByArray(uint32 seeds[], int length);* In TRandomMersenne only: Use this function if you want to initialize with* a seed with more than 32 bits. All bits in the seeds[] array will influence* the sequence of random numbers generated. length is the number of entries* in the seeds[] array.** double Random();* Gives a floating point random number in the interval 0 <= x < 1.* The resolution is 32 bits in TRanrotBGenerator, TRandomMotherOfAll and* TRandomMersenne. 52 or 63 bits in TRanrotWGenerator. 63 bits in * TRandomMotRot.** int IRandom(int min, int max);* Gives an integer random number in the interval min <= x <= max.* (max-min < MAXINT).* The resolution is the same as for Random(). ** uint32 BRandom();* Gives 32 random bits. * Only available in the classes TRanrotWGenerator and TRandomMersenne.*** Example:* ========* The file EX-RAN.CPP contains an example of how to generate random numbers.*** Further documentation:* ======================* The file randomc.htm contains further documentation on these random number* generators.**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -