summaryrefslogtreecommitdiff
path: root/src/stable/random.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/stable/random.h88
1 files changed, 44 insertions, 44 deletions
diff --git a/src/stable/random.h b/src/stable/random.h
index 43b8917..7989188 100644
--- a/src/stable/random.h
+++ b/src/stable/random.h
@@ -12,50 +12,50 @@
12 12
13namespace Bu 13namespace Bu
14{ 14{
15 class RandomBase; 15 class RandomBase;
16 class Random : public Bu::Singleton<Bu::Random> 16 class Random : public Bu::Singleton<Bu::Random>
17 { 17 {
18 friend class Bu::Singleton<Bu::Random>; 18 friend class Bu::Singleton<Bu::Random>;
19 private: 19 private:
20 Random(); 20 Random();
21 virtual ~Random(); 21 virtual ~Random();
22 22
23 public: 23 public:
24 template<typename cl> 24 template<typename cl>
25 static void setGenerator() 25 static void setGenerator()
26 { 26 {
27 delete getInstance().pGen; 27 delete getInstance().pGen;
28 getInstance().pGen = new cl(); 28 getInstance().pGen = new cl();
29 } 29 }
30 30
31 template<typename cl, typename t1> 31 template<typename cl, typename t1>
32 static void setGenerator( t1 p1 ) 32 static void setGenerator( t1 p1 )
33 { 33 {
34 delete getInstance().pGen; 34 delete getInstance().pGen;
35 getInstance().pGen = new cl( p1 ); 35 getInstance().pGen = new cl( p1 );
36 } 36 }
37 37
38 template<typename cl, typename t1, typename t2> 38 template<typename cl, typename t1, typename t2>
39 static void setGenerator( t1 p1, t2 p2 ) 39 static void setGenerator( t1 p1, t2 p2 )
40 { 40 {
41 delete getInstance().pGen; 41 delete getInstance().pGen;
42 getInstance().pGen = new cl( p1, p2 ); 42 getInstance().pGen = new cl( p1, p2 );
43 } 43 }
44 44
45 RandomBase &getGenerator() { return *pGen; } 45 RandomBase &getGenerator() { return *pGen; }
46 46
47 static void seed( int32_t iSeed ); 47 static void seed( int32_t iSeed );
48 static int32_t rand(); 48 static int32_t rand();
49 static int32_t rand( int32_t iMax ); 49 static int32_t rand( int32_t iMax );
50 static int32_t rand( int32_t iMin, int32_t iMax ); 50 static int32_t rand( int32_t iMin, int32_t iMax );
51 static double randNorm(); 51 static double randNorm();
52 52
53 private: 53 private:
54 void checkInit(); 54 void checkInit();
55 55
56 private: 56 private:
57 Bu::RandomBase *pGen; 57 Bu::RandomBase *pGen;
58 }; 58 };
59}; 59};
60 60
61#endif 61#endif