ESyS-Particle  4.0.1
Rng.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
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