Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/classcasa_1_1MLCG.html
Дата изменения: Unknown Дата индексирования: Mon Feb 14 19:59:12 2011 Кодировка: Поисковые слова: jupiter |
Multiplicative linear congruential generator. More...
#include <Random.h>
Public Member Functions | |
MLCG (Int seed1=0, Int seed2=1) | |
The constructor allows you to specify seeds. | |
virtual | ~MLCG () |
The destructor is trivial. | |
virtual uInt | asuInt () |
Return the 32-random bits as an unsigned integer. | |
virtual void | reset () |
Resets the random number generator. | |
Int | seed1 () const |
Functions that allow the user to retrieve or change the seed integers. | |
void | seed1 (Int s) |
Int | seed2 () const |
void | seed2 (Int s) |
void | reseed (Int s1, Int s2) |
Private Attributes | |
Int | itsInitSeedOne |
Int | itsInitSeedTwo |
Int | itsSeedOne |
Int | itsSeedTwo |
Multiplicative linear congruential generator.
Public interface
MLCG stands for "Multiplicative Linear Congruential Generator"
The MLCG
class implements a Multiplicative Linear Congruential Generator. In particular, it is an implementation of the double MLCG described in Efficient and Portable Combined Random Number Generators by Pierre L'Ecuyer, appearing in Communications of the ACM, Vol. 31. No. 6. This generator has a fairly long period, and has been statistically analyzed to show that it gives good inter-sample independence.
The constructor has two parameters, both of which are seeds for the generator. As in the ACG
generator, both seeds are modified to give a "better" distribution of seed digits. Thus, you can safely use values such as 0
or 1
for the seeds. The MLCG
generator used much less state than the ACG
generator; only two integers (8 bytes) are needed for each generator.
Warning: This class assumes that the integer and unsigned integer type is exactly 32 bits long;
Definition at line 305 of file Random.h.
The constructor allows you to specify seeds.
virtual casa::MLCG::~MLCG | ( | ) | [virtual] |
The destructor is trivial.
virtual uInt casa::MLCG::asuInt | ( | ) | [virtual] |
Return the 32-random bits as an unsigned integer.
Implements casa::RNG.
Definition at line 362 of file Random.h.
References itsInitSeedOne, itsInitSeedTwo, and reset().
virtual void casa::MLCG::reset | ( | ) | [virtual] |
void casa::MLCG::seed1 | ( | Int | s | ) | [inline] |
Definition at line 345 of file Random.h.
References itsInitSeedOne, and reset().
Int casa::MLCG::seed1 | ( | ) | const [inline] |
Functions that allow the user to retrieve or change the seed integers.
The seeds returned are not the user supplied values but the values obtained after some deterministic modification to produce a more uniform bit distribution.
Definition at line 340 of file Random.h.
References itsSeedOne.
void casa::MLCG::seed2 | ( | Int | s | ) | [inline] |
Definition at line 356 of file Random.h.
References itsInitSeedTwo, and reset().
Int casa::MLCG::seed2 | ( | ) | const [inline] |
Definition at line 351 of file Random.h.
References itsSeedTwo.
Int casa::MLCG::itsInitSeedOne [private] |
Int casa::MLCG::itsInitSeedTwo [private] |
Int casa::MLCG::itsSeedOne [private] |
Int casa::MLCG::itsSeedTwo [private] |