Libsaki
Core library of Pancake Mahjong
rand.h
1 #ifndef SAKI_RAND_H
2 #define SAKI_RAND_H
3 
4 #include <random>
5 #include <cstdint>
6 
7 
8 
9 namespace saki
10 {
11 
12 
13 
14 namespace util
15 {
16 
17 
18 
19 class Rand
20 {
21 public:
22  Rand();
23 
24  int32_t gen();
25  int32_t gen(int32_t mod);
26  uint32_t uGen(size_t mod);
27  uint32_t state() const;
28  void set(uint32_t state);
29 
30  std::minstd_rand &getUrbg();
31 
32 private:
33  std::minstd_rand mGen;
34  std::uniform_int_distribution<int> mDist;
35 };
36 
37 
38 
39 } // namespace util
40 
41 
42 
43 } // namespace saki
44 
45 
46 
47 #endif // SAKI_RAND_H
Definition: rand.h:19
std::minstd_rand & getUrbg()
Get reference to the Uniform Random Bit Generator.
Definition: rand.cpp:63
Definition: ai.cpp:18