StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EvtMTRandomEngine.hh
1 #ifdef EVTGEN_CPP11
2 //--------------------------------------------------------------------------
3 //
4 // Environment:
5 // This software is part of the EvtGen package. If you use all or part
6 // of it, please give an appropriate acknowledgement.
7 //
8 // Copyright Information: See EvtGen/COPYRIGHT
9 // Copyright (C) 2015 University of Warwick, UK
10 //
11 // Module: EvtGenBase/EvtMTRandomEngine.hh
12 //
13 // Generate random numbers using the Mersenne-Twister MT19937.
14 // Member function random returns a random number in the range ]0..1[.
15 // This requires c++11 features, hence the EVTGEN_CPP11 preprocessor.
16 //
17 // Modification history:
18 //
19 // John Back Aug 2015 Module created
20 //
21 //------------------------------------------------------------------------
22 
23 #ifndef EVTMTRANDOMENGINE_HH
24 #define EVTMTRANDOMENGINE_HH
25 
26 #include "EvtGenBase/EvtRandomEngine.hh"
27 
28 #include <random>
29 
30 class EvtMTRandomEngine : public EvtRandomEngine {
31 
32 public:
33 
34  EvtMTRandomEngine(unsigned int seed = 1430957218);
35 
36  virtual double random();
37 
38 private:
39 
40  std::mt19937 engine_;
41 
42  typedef std::uniform_real_distribution<double> URDist;
43  URDist distribution_;
44 
45 };
46 
47 #endif
48 
49 #endif