Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Random.hh

Go to the documentation of this file.
00001 #ifndef RANDOM_CLASS
00002 #define RANDOM_CLASS
00003 
00004 // ==== HEADER Random.hh ====
00005 
00017 // ==== CLASSES ====
00018 
00019 namespace RazorBack {
00020 
00022 class Randombase_
00023 {
00024     private:
00025     
00026     // data
00027     mutable int Seed1, Seed2;
00028     
00029     // methods
00030     public:
00031             
00037     explicit Randombase_(int S1=0, int S2=0)
00038     {
00039         reset(S1, S2);
00040     }
00041 
00043     virtual ~Randombase_() {}
00044     
00050     void reset(int S1=0, int S2=0);
00051 
00056     virtual double operator()(void) const =0;
00057     
00058     // hidden methods
00059     protected:
00060     
00061     int int_rand(void) const;
00062     double dbl_rand(void) const;
00063 };
00064 // END OF CLASS Randombase_
00065 
00067 class Randomuni_: public Randombase_
00068 {
00069     // methods
00070     public:
00071     
00077     explicit Randomuni_(int S1=0, int S2=0):
00078             Randombase_(S1, S2) {}
00079     
00081     double operator()(void) const { return dbl_rand(); }
00082     
00084     double rnd_lim(double L, double U) const
00085     {
00086         return((L-U)*dbl_rand()+U);
00087     }
00088 };
00089 // END OF CLASS Randomuni_
00090 
00095 class Randomnorm_: public Randombase_
00096 {
00097     // methods
00098     public:
00099             
00105     explicit Randomnorm_(int S1=0, int S2=0): 
00106             Randombase_(S1, S2) {}
00107 
00112     double operator()(void) const;
00113 
00118     double rnd_msd(double M, double S) const
00119     {
00120         return( S*operator()()+M );
00121     }
00122 };
00123 // END OF CLASS Randomnorm_
00124 
00125 } // RazorBack
00126 
00127 // ==== END OF HEADER Random.hh ====
00128 
00129 #endif      // RANDOM_CLASS

Generated at Wed Aug 21 09:33:12 2002 for The Razorback C++ Library: Statistics by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001