PM_LCG.h

00001 /*  _________________________________________________________________________
00002  *
00003  *  UTILIB: A utility library for developing portable C++ codes.
00004  *  Copyright (c) 2001, Sandia National Laboratories.
00005  *  This software is distributed under the GNU Lesser General Public License.
00006  *  For more information, see the README file in the top UTILIB directory.
00007  *  _________________________________________________________________________
00008  */
00009 
00010 //
00011 // PM_LCG.h
00012 //
00021 #ifndef __PM_LCG_h
00022 #define __PM_LCG_h
00023 
00024 #include "RNG.h"
00025 
00026 
00027 #ifdef SWIG
00028 class PM_LCG : public RNG {
00029 #else
00030 class UTILIB_API PM_LCG : public RNG {
00031 #endif
00032 
00033 public:
00034 
00038   PM_LCG(int seed = 0) {jseed = seed; reset();}
00039 
00041   void reseed(int seed) {jseed = seed; reset();}
00043   int getSeed() {return jseed;}
00044 
00046   virtual void reset();
00048   virtual unsigned long asLong();
00050   virtual double asDouble();
00051 #if defined (COUGAR) || defined(SGI) || defined(NON_ANSI) || defined(OSF)
00052 
00053   virtual int write(ostream& output) const;
00055   virtual int read(istream& input);
00056 #else
00057 
00058   virtual int write(std::ostream& output) const;
00060   virtual int read(std::istream& input);
00061 #endif
00062 
00063 private:
00064 
00066   int state;
00072   int jseed;
00073 };
00074 
00075 #endif
00076 
00077