![]() |
CASToR
1.0
Tomographic Reconstruction (PET/SPECT)
|
00001 00009 #ifndef SRNG_HH 00010 #define SRNG_HH 1 00011 00012 #include "gVariables.hh" 00013 #include "sOutputManager.hh" 00014 00015 00016 00017 00023 class sRNG 00024 { 00025 // ------------------------------------------------------------------- 00026 // Constructor & Destructor 00027 public: 00034 static sRNG* GetInstance() 00035 { 00036 if (mp_Instance == NULL) mp_Instance = new sRNG(); 00037 return mp_Instance; 00038 } 00039 00040 00041 // ------------------------------------------------------------------- 00042 // Public member functions 00043 public: 00044 typedef mt19937 Engine; 00045 typedef uniform_real_distribution<double> Distribution; 00053 int Initialize(int a_nbThreads); 00054 00064 int Initialize(int64_t a_seed, int a_nbThreads); 00073 double GenerateRdmNber(); 00080 double GenerateNonThreadedRdmNber(); 00087 Engine* GetNonThreadedGenerator(); 00093 void SetVerbose(int a_verboseLevel) {m_verbose = a_verboseLevel;}; 00094 00095 00096 // ------------------------------------------------------------------- 00097 // Private member functions 00098 private: 00103 sRNG(); 00108 ~sRNG(); 00109 // Prevent the compiler generating methods of copy the object : 00110 sRNG(sRNG const&); 00111 void operator=(sRNG const&); 00112 00113 00114 // ------------------------------------------------------------------- 00115 // Data members 00116 private: 00117 static sRNG* mp_Instance; 00118 int m_verbose; 00119 vector<Engine> mp_Engines; 00120 Engine* mp_NonThreadedEngine; 00122 Distribution mp_Distribution; 00123 }; 00124 00125 #endif