Arty
samplers.h
1 #ifndef SAMPLERS_H
2 #define SAMPLERS_H
3 
4 #include <cmath>
5 #include <random>
6 
7 #include "float3.h"
8 #include "random.h"
9 #include "common.h"
10 
12 class Sampler {
13 public:
14  virtual ~Sampler() {}
15  virtual float operator () () = 0;
16 };
17 
19 class UniformSampler : public Sampler {
20 public:
21  UniformSampler() : uniform01(0, 1) {}
22 
23  UniformSampler(uint32_t seed)
24  : UniformSampler()
25  {
26  rnd_gen.seed(seed);
27  }
28 
29  float operator () () override { return uniform01(rnd_gen); }
30 
31 private:
32  std::mt19937 rnd_gen;
33  std::uniform_real_distribution<float> uniform01;
34 };
35 
36 #endif // SAMPLERS_H
Sampler object, used at the level of the integrator to control how the random number generation is do...
Definition: samplers.h:12
Uniform sampler, the easiest and most simple sampling method.
Definition: samplers.h:19