crng.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CRNG_H
00020 #define __CRNG_H
00021
00022 #include "simkerneldefs.h"
00023 #include "cobject.h"
00024
00025 NAMESPACE_BEGIN
00026
00027 class cConfiguration;
00028
00029
00051 class SIM_API cRNG : public cObject
00052 {
00053 protected:
00054 unsigned long numDrawn;
00055
00056 public:
00057 cRNG() {numDrawn=0;}
00058 virtual ~cRNG() {}
00059
00064 virtual void initialize(int seedSet, int rngId, int numRngs,
00065 int parsimProcId, int parsimNumPartitions,
00066 cConfiguration *cfg) = 0;
00067
00074 virtual void selfTest() = 0;
00075
00080 virtual unsigned long getNumbersDrawn() const {return numDrawn;}
00081
00085 virtual unsigned long intRand() = 0;
00086
00090 virtual unsigned long intRandMax() = 0;
00091
00095 virtual unsigned long intRand(unsigned long n) = 0;
00096
00100 virtual double doubleRand() = 0;
00101
00105 virtual double doubleRandNonz() = 0;
00106
00110 virtual double doubleRandIncl1() = 0;
00111
00115 double doubleRandNonzIncl1() {return 1-doubleRand();}
00116 };
00117
00118 NAMESPACE_END
00119
00120
00121 #endif
00122