Scopira
20080306
|
Scopira includes a collection of random number generation classes that allow for complete control over random number generation and distribution. A light wrapper API is also provided for the basic OS provided random number generation, including any "real" random number generation services that may be provided.
However, you should favour the Scopira provided classes for serveral reasons:
Broken down by header file:
All the random number generators and distributions follow a general compile type form - borrowed from boost (boost, boost's random). This makes them fast.
To use these generators, you maintain an instance of one of the seed-able, local-state generators (currently, either minstd_rand or minstd_rand0). Call this your random generator core.
Around your random core, you can have one or more distributions. Every time you ask them for a number, they ask the core then massage it to fit their distributions.
All random generators and distributions provide you with various methods. min() and max() return just that. operator() returns you the next number in the sequence.
Here is an example: