summaryrefslogtreecommitdiff
path: root/src/tests/random.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-09 19:10:54 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-09 19:10:54 +0000
commit21df391dc6055884e621181cbc3b51d9ec2b095c (patch)
treed92f3423c0585459fdfc0755ae415f0832d478b3 /src/tests/random.cpp
parent21e13f0b2c5242a2ee84b404a96d456e5b753056 (diff)
downloadlibbu++-21df391dc6055884e621181cbc3b51d9ec2b095c.tar.gz
libbu++-21df391dc6055884e621181cbc3b51d9ec2b095c.tar.bz2
libbu++-21df391dc6055884e621181cbc3b51d9ec2b095c.tar.xz
libbu++-21df391dc6055884e621181cbc3b51d9ec2b095c.zip
Added Mersenne Twister random number generator.
Diffstat (limited to 'src/tests/random.cpp')
-rw-r--r--src/tests/random.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tests/random.cpp b/src/tests/random.cpp
index 95cdb0a..d7b94ce 100644
--- a/src/tests/random.cpp
+++ b/src/tests/random.cpp
@@ -1,6 +1,7 @@
1#include <bu/randombasic.h> 1#include <bu/randombasic.h>
2#include <bu/randomcmwc.h> 2#include <bu/randomcmwc.h>
3#include <bu/randomsystem.h> 3#include <bu/randomsystem.h>
4#include <bu/randommersenne.h>
4#include <bu/sio.h> 5#include <bu/sio.h>
5#include <time.h> 6#include <time.h>
6 7
@@ -15,7 +16,7 @@ void coverage()
15 uint32_t uBucket[78]; 16 uint32_t uBucket[78];
16 memset( uBucket, 0, sizeof(uint32_t)*78 ); 17 memset( uBucket, 0, sizeof(uint32_t)*78 );
17 18
18 for( int j = 0; j < 1000; j++ ) 19 for( int j = 0; j < 1000000; j++ )
19 { 20 {
20 uBucket[(int)(((uint32_t)rand.rand())/(double)(0xfffffffful)*78+0.5)]++; 21 uBucket[(int)(((uint32_t)rand.rand())/(double)(0xfffffffful)*78+0.5)]++;
21 } 22 }
@@ -43,6 +44,7 @@ int main()
43 coverage<RandomBasic>(); 44 coverage<RandomBasic>();
44 coverage<RandomCmwc>(); 45 coverage<RandomCmwc>();
45 coverage<RandomSystem>(); 46 coverage<RandomSystem>();
47 coverage<RandomMersenne>();
46 48
47 return 0; 49 return 0;
48} 50}