diff options
Diffstat (limited to 'src/experimental/random.h')
-rw-r--r-- | src/experimental/random.h | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/experimental/random.h b/src/experimental/random.h deleted file mode 100644 index ba26f21..0000000 --- a/src/experimental/random.h +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2012 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | #ifndef BU_RANDOM_H | ||
8 | #define BU_RANDOM_H | ||
9 | |||
10 | #include "bu/singleton.h" | ||
11 | #include <stdint.h> | ||
12 | |||
13 | namespace Bu | ||
14 | { | ||
15 | class RandomBase; | ||
16 | class Random : public Bu::Singleton<Bu::Random> | ||
17 | { | ||
18 | friend class Bu::Singleton<Bu::Random>; | ||
19 | private: | ||
20 | Random(); | ||
21 | virtual ~Random(); | ||
22 | |||
23 | public: | ||
24 | template<typename cl> | ||
25 | static void setGenerator() | ||
26 | { | ||
27 | delete getInstance().pGen; | ||
28 | getInstance().pGen = new cl(); | ||
29 | } | ||
30 | |||
31 | template<typename cl, typename t1> | ||
32 | static void setGenerator( t1 p1 ) | ||
33 | { | ||
34 | delete getInstance().pGen; | ||
35 | getInstance().pGen = new cl( p1 ); | ||
36 | } | ||
37 | |||
38 | template<typename cl, typename t1, typename t2> | ||
39 | static void setGenerator( t1 p1, t2 p2 ) | ||
40 | { | ||
41 | delete getInstance().pGen; | ||
42 | getInstance().pGen = new cl( p1, p2 ); | ||
43 | } | ||
44 | |||
45 | RandomBase &getGenerator() { return *pGen; } | ||
46 | |||
47 | static int32_t rand(); | ||
48 | static void seed( int32_t iSeed ); | ||
49 | |||
50 | private: | ||
51 | void checkInit(); | ||
52 | |||
53 | private: | ||
54 | Bu::RandomBase *pGen; | ||
55 | }; | ||
56 | }; | ||
57 | |||
58 | #endif | ||
59 | |||