LCOV - code coverage report
Current view: top level - tools - Random.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 1 1 100.0 %
Date: 2020-11-18 11:20:57 Functions: 0 0 -

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2012-2019 The plumed team
       3             :    (see the PEOPLE file at the root of the distribution for a list of names)
       4             : 
       5             :    See http://www.plumed.org for more information.
       6             : 
       7             :    This file is part of plumed, version 2.
       8             : 
       9             :    plumed is free software: you can redistribute it and/or modify
      10             :    it under the terms of the GNU Lesser General Public License as published by
      11             :    the Free Software Foundation, either version 3 of the License, or
      12             :    (at your option) any later version.
      13             : 
      14             :    plumed is distributed in the hope that it will be useful,
      15             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17             :    GNU Lesser General Public License for more details.
      18             : 
      19             :    You should have received a copy of the GNU Lesser General Public License
      20             :    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
      21             : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
      22             : #ifndef __PLUMED_tools_Random_h
      23             : #define __PLUMED_tools_Random_h
      24             : 
      25             : #include <string>
      26             : #include <vector>
      27             : #include <iosfwd>
      28             : 
      29             : namespace PLMD {
      30             : 
      31             : /// \ingroup TOOLBOX
      32        3031 : class Random {
      33             :   static const int IA=16807,IM=2147483647,IQ=127773,IR=2836,NTAB=32;
      34             :   static const int NDIV=(1+(IM-1)/NTAB);
      35             :   static const double EPS;
      36             :   static const double AM;
      37             :   static const double RNMX;
      38             :   static const double fact;
      39             :   static const std::string noname;
      40             :   bool incPrec;
      41             :   bool switchGaussian;
      42             :   double saveGaussian;
      43             :   int iy;
      44             :   int iv[NTAB];
      45             :   int idum;
      46             :   std::string name;
      47             : public:
      48             :   explicit Random(const std::string & name=noname);
      49             :   void setSeed(int idum);
      50             :   double RandU01();
      51             :   double U01();
      52             :   double U01d();
      53             :   int RandInt(int i);
      54             :   void Shuffle(std::vector<unsigned>& vec);
      55             :   void WriteStateFull(std::ostream &)const;
      56             :   void ReadStateFull (std::istream &);
      57             :   void fromString(const std::string & str);
      58             :   void toString(std::string & str)const;
      59             :   friend std::ostream & operator<<(std::ostream & out,const Random & rng) {
      60             :     rng.WriteStateFull(out); return out;
      61             :   }
      62             :   friend std::istream & operator>>(std::istream & in,Random & rng) {
      63             :     rng.ReadStateFull(in); return in;
      64             :   }
      65             :   double Gaussian();
      66             :   void IncreasedPrecis(bool i) {incPrec=i;}
      67             : };
      68             : 
      69             : }
      70             : 
      71             : #endif
      72             : 

Generated by: LCOV version 1.13