00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_RANDOM_GENERATOR_H_
00028 #define CEYLAN_RANDOM_GENERATOR_H_
00029
00030
00031 #include "CeylanObject.h"
00032 #include "CeylanProbability.h"
00033 #include "CeylanMathsBasic.h"
00034
00035
00036 #include <string>
00037
00038
00039
00040
00041 namespace Ceylan
00042 {
00043
00044
00045 namespace Maths
00046 {
00047
00048
00049 namespace Random
00050 {
00051
00052
00053
00055 typedef unsigned int Seed ;
00056
00057
00059 typedef unsigned int RandomValue ;
00060
00061
00062
00070 class CEYLAN_DLL RandomGenerator : public Ceylan::Object
00071 {
00072
00073
00074 public:
00075
00076
00077
00094 RandomGenerator( Sample lowerLimit, Sample upperLimit,
00095 Seed aSeed = DefaultSeed ) ;
00096
00097
00099 virtual ~RandomGenerator() throw() ;
00100
00101
00102
00104 virtual RandomValue getNewValue() = 0 ;
00105
00106
00107
00109 virtual void reset( Seed newSeed ) = 0 ;
00110
00111
00112
00125 virtual const std::string toString(
00126 VerbosityLevels level = high ) const ;
00127
00128
00129
00130
00131
00132
00133
00135 static const Seed DefaultSeed ;
00136
00137
00138
00139
00140 protected:
00141
00142
00143
00149 virtual void preCompute() = 0 ;
00150
00151
00152
00158 Sample _lowerLimit ;
00159
00160
00161
00168 Sample _upperLimit ;
00169
00170
00171
00177 Seed _seed ;
00178
00179
00180
00181
00182 private:
00183
00184
00185
00190 RandomGenerator( const RandomGenerator & source ) ;
00191
00192
00193
00203 RandomGenerator & operator = (
00204 const RandomGenerator & source ) ;
00205
00206
00207 } ;
00208
00209
00210 }
00211
00212 }
00213
00214 }
00215
00216
00217
00218 #endif // CEYLAN_RANDOM_GENERATOR_H_
00219