Skip to content

Pseudorandom Number Generators

th5th edited this page Jan 25, 2012 · 4 revisions

Implementations of several well tested PRNGs are included in libcea for use by genetic operators. The PRNGs are implemented as classes derived from the CeaPrng abstract class. This allows them to be used through pointers of type CeaPrng* - delicious polymorphism. User-defined PRNGs should also derive from the CeaPrng base class to make them compatible with the rest of the framework.

Below is a rough outline of the four generators to be included with libcea. Before release the implementations will be thoroughly tested and documented for speed, memory usage and quality.

Linear Congruential Generator (LCG)

CeaPrngLCG

The lowest quality and highest speed generator included with libcea. Not recommended for use in anything but the quickest and dirtiest EAs.

Multiply with Carry (MWC)

CeaPrngMWC

Improvement on LCG without too much loss of speed. This generator will probably come with the ability to lag the output, producing a complementary MWC (CMWC). CMWCs exhibit better fairness in the MSB and more easily calculated periods, at the expense of slightly slower iterations and higher memory use (proportional to the lag). Supposedly faster and having a longer period than MT19937 without loss of quality.

Mersenne Twister (MT19937)

CeaPrngMT19937

Implementation of the well known Mersenne Twister algorithm. High quality, Good performance and low memory usage (less than CMWC).

ISAAC

CeaPrngISAAC

An implementation of the ISAAC (Indirection, Shift, Accumulate, Add, Count) PRNG. ISAAC is actually cryptographically secure, but is fast enough to be competitive with the other PRNGs given in libcea (which are not cryptographically secure).

Clone this wiki locally