aboutsummaryrefslogtreecommitdiff
path: root/src/stable/randombase.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-08-18 23:43:21 +0000
committerMike Buland <eichlan@xagasoft.com>2012-08-18 23:43:21 +0000
commitf5ac2c1ba333ce6aa6d385d9a63b658caaa46503 (patch)
treecd78edf4663967a99c483fd0a7f0506328cab008 /src/stable/randombase.h
parent80aa35bbeca7d034c788be9942725dae9d3f46c4 (diff)
downloadlibbu++-f5ac2c1ba333ce6aa6d385d9a63b658caaa46503.tar.gz
libbu++-f5ac2c1ba333ce6aa6d385d9a63b658caaa46503.tar.bz2
libbu++-f5ac2c1ba333ce6aa6d385d9a63b658caaa46503.tar.xz
libbu++-f5ac2c1ba333ce6aa6d385d9a63b658caaa46503.zip
Added hashtable += support, optomized the random number base some?
Diffstat (limited to 'src/stable/randombase.h')
-rw-r--r--src/stable/randombase.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/stable/randombase.h b/src/stable/randombase.h
index a5a4f42..d33bb99 100644
--- a/src/stable/randombase.h
+++ b/src/stable/randombase.h
@@ -19,9 +19,16 @@ namespace Bu
19 19
20 virtual void seed( int32_t iSeed )=0; 20 virtual void seed( int32_t iSeed )=0;
21 virtual int32_t rand()=0; 21 virtual int32_t rand()=0;
22 virtual int32_t rand( int32_t iMax ); 22 virtual inline int32_t rand( int32_t iMax ) {
23 virtual int32_t rand( int32_t iMin, int32_t iMax ); 23 return rand( 0, iMax );
24 virtual double randNorm(); 24 }
25 virtual inline int32_t rand( int32_t iMin, int32_t iMax ) {
26 return iMin+(randNorm()*(iMax-iMin));
27 }
28 virtual inline double randNorm() {
29 return (((uint32_t)rand())&0xfffffffeul)*0x1.00000001p-32;
30// return (((uint32_t)rand())&0xfffffffeul)/(double)(0xfffffffful);
31 }
25 }; 32 };
26}; 33};
27 34