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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/clhep/include/CLHEP/Random/RanluxppEngine.h (Version 11.3.0) and /externals/clhep/include/CLHEP/Random/RanluxppEngine.h (Version 9.6.p3)


  1 //                                                  1 
  2 // -*- C++ -*-                                    
  3 //                                                
  4 // -------------------------------------------    
  5 //                             HEP Random         
  6 //                       --- RanluxppEngine --    
  7 //                         class header file      
  8 // -------------------------------------------    
  9 // Implementation of the RANLUX++ generator       
 10 //                                                
 11 // RANLUX++ is an LCG equivalent of RANLUX usi    
 12 //                                                
 13 // References:                                    
 14 // A. Sibidanov                                   
 15 //   A revision of the subtract-with-borrow ra    
 16 //   Computer Physics Communications, 221(2017    
 17 //                                                
 18 // J. Hahnfeld, L. Moneta                         
 19 //   A Portable Implementation of RANLUX++        
 20 //   vCHEP2021                                    
 21                                                   
 22 #ifndef RanluxppEngine_h                          
 23 #define RanluxppEngine_h                          
 24                                                   
 25 #include "CLHEP/Random/RandomEngine.h"            
 26                                                   
 27 #include <cstdint>                                
 28                                                   
 29 namespace CLHEP {                                 
 30                                                   
 31 /**                                               
 32  * @author Jonas Hahnfeld                         
 33  * @ingroup random                                
 34  */                                               
 35 class RanluxppEngine final : public HepRandomE    
 36                                                   
 37 public:                                           
 38   RanluxppEngine();                               
 39   RanluxppEngine(long seed);                      
 40   RanluxppEngine(std::istream &is);               
 41   virtual ~RanluxppEngine();                      
 42   // Constructors and destructor                  
 43                                                   
 44   double flat() override;                         
 45   // It returns a pseudo random number between    
 46   // excluding the end points.                    
 47                                                   
 48   void flatArray(const int size, double *vect)    
 49   // Fills the array "vect" of specified size     
 50                                                   
 51   void setSeed(long seed, int dummy = 0) overr    
 52   // Sets the state of the algorithm according    
 53                                                   
 54   void setSeeds(const long *seeds, int dummy =    
 55   // Sets the state of the algorithm according    
 56   // array of seeds.  Only the first seed is u    
 57                                                   
 58   void skip(uint64_t n);                          
 59   // Skip `n` random numbers without generatin    
 60                                                   
 61   void saveStatus(const char filename[] = "Ran    
 62   // Saves in named file the current engine st    
 63                                                   
 64   void restoreStatus(const char filename[] = "    
 65   // Reads from named file the last saved engi    
 66                                                   
 67   void showStatus() const override;               
 68   // Dumps the engine status on the screen.       
 69                                                   
 70   std::string name() const override;              
 71                                                   
 72   // Optional methods to serialize the engine'    
 73   static std::string engineName();                
 74   static std::string beginTag();                  
 75                                                   
 76   std::ostream &put(std::ostream &os) const ov    
 77   std::istream &get(std::istream &is) override    
 78                                                   
 79   std::istream &getState(std::istream &is) ove    
 80                                                   
 81   std::vector<unsigned long> put() const overr    
 82   bool get(const std::vector<unsigned long> &v    
 83   bool getState(const std::vector<unsigned lon    
 84                                                   
 85   // Save and restore to/from streams             
 86   operator double() override { return flat();     
 87   operator float() override { return float(fla    
 88   operator unsigned int() override { return (u    
 89                                                   
 90   // 1 value for the engine ID, 2 * 9 values f    
 91   // for the carry bit and the position.          
 92   static const unsigned int VECTOR_STATE_SIZE     
 93                                                   
 94 private:                                          
 95   void advance();                                 
 96   uint64_t nextRandomBits();                      
 97                                                   
 98   uint64_t fState[9]; ///< RANLUX state of the    
 99   unsigned fCarry;    ///< Carry bit of the RA    
100   int fPosition = 0;  ///< Current position in    
101                                                   
102 }; // RanluxppEngine                              
103                                                   
104 } // namespace CLHEP                              
105                                                   
106 #endif                                            
107