The spica renderer
random.h
1 #ifdef _MSC_VER
2 #pragma once
3 #endif
4 
5 #ifndef _SPICA_RANDOM_H_
6 #define _SPICA_RANDOM_H_
7 
8 #include "core/common.h"
9 #include "sampler.h"
10 
11 namespace spica {
12 
17  class SPICA_EXPORTS Random {
18  private:
19  static const int N = 624;
20  static const int M = 397;
21  static const unsigned int MATRIX_A;
22  static const unsigned int UPPER_MASK;
23  static const unsigned int LOWER_MASK;
24 
25  unsigned int mt[N];
26  int mti;
27 
28  public:
29  explicit Random(unsigned int seed = 0);
30 
31  int nextInt();
32 
35  int nextInt(const int n);
36 
39  double nextReal();
40 
43  double normal();
44 
45  double get1D();
46  Point2d get2D();
47 
48  private:
49  void init_genrand(unsigned int s);
50  unsigned int genrand_int32(void);
51  int genrand_int31(void);
52  double genrand_real2(void);
53  };
54 
55 } // namespace spica
56 
57 #endif // _SPICA_RANDOM_H_
Random number generator with Mersenne twister.
Definition: random.h:17