aboutsummaryrefslogtreecommitdiff
path: root/src/stable/randommersenne.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/stable/randommersenne.h')
-rw-r--r--src/stable/randommersenne.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/stable/randommersenne.h b/src/stable/randommersenne.h
new file mode 100644
index 0000000..27c100e
--- /dev/null
+++ b/src/stable/randommersenne.h
@@ -0,0 +1,31 @@
1#ifndef BU_RANDOM_MERSENNE_H
2#define BU_RANDOM_MERSENNE_H
3
4#include "bu/randombase.h"
5
6namespace Bu
7{
8 /**
9 * An implementation of Mersenne Twister (MT19937) algorithm. This as an
10 * algorithm with an excellent reputation for very good random number
11 * generation and a very large period. It is however, relatively slow and
12 * complex compared to, say the Complementary Multiply With Carry
13 * (Bu::RandomCmwc), and may not actually be a *better* random number
14 * generator.
15 */
16 class RandomMersenne : public Bu::RandomBase
17 {
18 public:
19 RandomMersenne( int32_t iSeed=0 );
20 virtual ~RandomMersenne();
21
22 virtual void seed( int32_t iSeed );
23 virtual int32_t rand();
24
25 private:
26 int32_t iIndex;
27 uint32_t iMt[624];
28 };
29};
30
31#endif