Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:09:49

0001 #ifndef ATOOLS__Math__Marsaglia_H
0002 #define ATOOLS__Math__Marsaglia_H
0003 
0004 #include <iostream>
0005 
0006 namespace ATOOLS {
0007 
0008   /*
0009     Combined KISS and SWB generator by George Marsaglia
0010 
0011     http://groups.google.co.uk/group/sci.stat.math/msg/edcb117233979602
0012     http://groups.google.co.uk/group/sci.math.num-analysis/msg/eb4ddde782b17051
0013    */
0014 
0015   class Marsaglia {
0016   public:
0017 
0018     typedef unsigned int UL;
0019 
0020   private:
0021 
0022     UL m_z, m_w, m_jsr, m_jcong;
0023     UL m_t[256], m_x, m_y, m_bro;
0024 
0025     unsigned char m_c;
0026 
0027   public:
0028 
0029     Marsaglia();
0030 
0031     void Init(UL i1,UL i2,UL i3,UL i4);
0032   
0033     double Get();
0034 
0035     void WriteStatus(std::ostream &str);
0036     bool ReadStatus(std::istream &str);
0037 
0038   };// end of class Marsaglia
0039 
0040 }// end of namespace ATOOLS
0041 
0042 #endif