Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
RandomEngineSTL.hh
Go to the documentation of this file.
1#ifndef G_RANDOM_ENGINE_STL_H
2#define G_RANDOM_ENGINE_STL_H
3
4#include <random>
5
7
8namespace Garfield {
9
11 : public RandomEngine<RandomEngineSTL, std::mt19937::result_type> {
12 public:
13 RandomEngineSTL() = default;
14 RandomEngineSTL(const std::mt19937::result_type& seed) : RandomEngine(seed) {}
15 inline double Draw() {
16 return std::generate_canonical<double, std::numeric_limits<double>::digits>(
17 m_rng);
18 }
19 inline void SetSeed(const seed_t& seed) { m_rng.seed(seed); }
20 inline seed_t GetSeed() { return m_seed; }
21 void Print();
22
23 private:
24 std::mt19937 m_rng{std::random_device{}()};
25};
26
27} // namespace Garfield
28
29#endif
void SetSeed(const seed_t &seed)
RandomEngineSTL(const std::mt19937::result_type &seed)