aboutsummaryrefslogtreecommitdiff
path: root/src/stable/randombase.h
diff options
context:
space:
mode:
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