ESyS-Particle  2.3
Rng.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 
14 #ifndef ESYS_LSMRNG_H
15 #define ESYS_LSMRNG_H
16 
17 #include <boost/random.hpp>
18 
19 namespace esys
20 {
21  namespace lsm
22  {
26  template <typename TmplRng=boost::mt19937>
27  class UniformRng
28  {
29  public:
30  typedef TmplRng Rng;
31  typedef boost::uniform_real<> UniformReal;
32  typedef boost::variate_generator<Rng &, UniformReal> Generator;
33 
39  UniformRng(double minRn, double maxRn);
40 
45  double operator()();
46 
50  void seed();
51 
56  template <typename Tmpl>
57  void seed(Tmpl &s);
58 
64  template <typename TmplIt>
65  void seed(TmplIt begin, TmplIt end);
66 
67  private:
68  Rng m_rng;
69  UniformReal m_uniform;
70  Generator m_generator;
71  };
72 
74 
75  namespace rng
76  {
77  extern DefaultUniformRng s_zeroOneUniform;
78  }
79  }
80 }
81 
82 #include "Foundation/Rng.hpp"
83 
84 #endif
UniformReal m_uniform
Definition: Rng.h:69
UniformRng DefaultUniformRng
Definition: Rng.h:73
double operator()()
Definition: Rng.hpp:27
Definition: CheckPointable.cpp:16
Generator m_generator
Definition: Rng.h:70
DefaultUniformRng s_zeroOneUniform(0.0, 1.0)
Definition: Rng.h:77
Rng m_rng
Definition: Rng.h:68
void seed()
Definition: Rng.hpp:33
boost::uniform_real UniformReal
Definition: Rng.h:31
TmplRng Rng
Definition: Rng.h:30
boost::variate_generator< Rng &, UniformReal > Generator
Definition: Rng.h:32
UniformRng(double minRn, double maxRn)
Definition: Rng.hpp:19
Definition: Rng.h:27