00001 #ifndef GLRANDOMNUMBERSGENERATOR_H_ 00002 #define GLRANDOMNUMBERSGENERATOR_H_ 00003 #include <stdlib.h> 00004 #include <vector> 00005 using namespace std; 00006 00015 class GLRandomNumbersGenerator 00016 { 00017 public: 00021 enum GeneratorConstants 00022 { 00023 UNINITIALISED_SEED = -1 00024 }; 00025 00029 virtual ~GLRandomNumbersGenerator() {}; 00030 00034 static long getMaxNumber() { return RAND_MAX; } 00039 static long getRandomInteger(); 00040 00046 static long getRandomInteger(const long& max); 00047 00054 static long getRandomInteger(const long& min, const long& max); 00055 00070 // static void getRandomIntegerVector( 00071 // vector<int>& result, 00072 // const long &min, 00073 // const long &max, 00074 // const long& size, 00075 // bool mayRepeat = false); 00076 00082 static double getRandomUniform(const double& left, 00083 const double& right); 00084 00091 static long getSeed() {return m_initial_seed; } 00092 00103 static long initGenerator(long seed = UNINITIALISED_SEED); 00104 00110 static int isInitialised() {return m_is_initialised; } 00111 00120 static void shuffleIntegerVector(vector<int>& result, 00121 const long &min, 00122 const long &max); 00123 private: 00127 GLRandomNumbersGenerator(){}; 00128 private: 00131 static bool m_is_initialised; 00133 static long m_initial_seed; 00134 }; 00135 00136 #endif /*GLRANDOMNUMBERSGENERATOR_H_*/