diff options
Diffstat (limited to '')
-rw-r--r-- | src/stable/randombase.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/stable/randombase.h b/src/stable/randombase.h index d33bb99..946284f 100644 --- a/src/stable/randombase.h +++ b/src/stable/randombase.h | |||
@@ -11,25 +11,25 @@ | |||
11 | 11 | ||
12 | namespace Bu | 12 | namespace Bu |
13 | { | 13 | { |
14 | class RandomBase | 14 | class RandomBase |
15 | { | 15 | { |
16 | public: | 16 | public: |
17 | RandomBase(); | 17 | RandomBase(); |
18 | virtual ~RandomBase(); | 18 | virtual ~RandomBase(); |
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 inline int32_t rand( int32_t iMax ) { | 22 | virtual inline int32_t rand( int32_t iMax ) { |
23 | return rand( 0, iMax ); | 23 | return rand( 0, iMax ); |
24 | } | 24 | } |
25 | virtual inline int32_t rand( int32_t iMin, int32_t iMax ) { | 25 | virtual inline int32_t rand( int32_t iMin, int32_t iMax ) { |
26 | return iMin+(randNorm()*(iMax-iMin)); | 26 | return iMin+(randNorm()*(iMax-iMin)); |
27 | } | 27 | } |
28 | virtual inline double randNorm() { | 28 | virtual inline double randNorm() { |
29 | return (((uint32_t)rand())&0xfffffffeul)*0x1.00000001p-32; | 29 | return (((uint32_t)rand())&0xfffffffeul)*0x1.00000001p-32; |
30 | // return (((uint32_t)rand())&0xfffffffeul)/(double)(0xfffffffful); | 30 | // return (((uint32_t)rand())&0xfffffffeul)/(double)(0xfffffffful); |
31 | } | 31 | } |
32 | }; | 32 | }; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | #endif | 35 | #endif |