Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:20

0001 #ifndef PHOOL_PHRANDOMSEED_H
0002 #define PHOOL_PHRANDOMSEED_H
0003 
0004 //! standard way to get a random seed:
0005 //! `unsigned int seed = PHRandomSeed();`
0006 //! It return fix seed sequence if recoConsts RANDOMSEED is set.
0007 //! If values are preloaded via PHRandomSeed::LoadSeed, they are returned in loaded order
0008 //! otherwise it return a random seed from std::random_device rdev
0009 class PHRandomSeed
0010 {
0011  public:
0012   PHRandomSeed() = default;
0013   virtual ~PHRandomSeed() = default;
0014   //! conversion operator for `unsigned int seed = PHRandomSeed();`
0015   operator unsigned int() const
0016   {
0017     return GetSeed();
0018   }
0019 
0020   //! get a seed
0021   static unsigned int GetSeed();
0022   static void LoadSeed(const unsigned int iseed);
0023   static void Verbosity(const int iverb);
0024   static int Verbosity() { return verbose; };
0025 
0026  protected:
0027   static void InitSeed();
0028   static bool fFixed;
0029   static bool fInitialized;
0030   static int verbose;
0031 };
0032 
0033 #endif