< index < 8. All purposes container | ===================================== 9. Pseudorandom number generator ===================================== | > 10. Noise generator

This toolkit is an implementation of two fast and high quality pseudorandom number generators:

- a Mersenne twister generator
- a Complementary-Multiply-With-Carry generator,

CMWC is faster than MT (see table below) and has a much better period (1039460 vs. 106001). It is the default algo since libtcod 1.5.0.
Relative performances in two independent tests:

Algorithm | Numbers generated | Perf (1) | Perf (2)
--- | --- | --- | ---
MT | integer | 62 | 50
MT | float | 54 | 45
CMWC | integer | 21 | 34
CMWC | float | 32 | 27

For python users :
Python already has great builtin random generators. But some parts of the Doryen library (noise, heightmap, ...) uses RNG as parameters. If you intend to use those functions, you must provide a RNG created with the library.

9.1 Creating a generator
9.2 Using a generator
9.3 Destroying a generator