Logo ROOT  
Reference Guide
RanluxppEngine.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Author: Jonas Hahnfeld 11/2020
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_Math_RanluxppEngine
13 #define ROOT_Math_RanluxppEngine
14 
15 #include "Math/TRandomEngine.h"
16 
17 #include <cstdint>
18 #include <memory>
19 
20 namespace ROOT {
21 namespace Math {
22 
23 template <int w, int p>
24 class RanluxppEngineImpl;
25 
26 template <int p>
27 class RanluxppEngine final : public TRandomEngine {
28 
29 private:
30  std::unique_ptr<RanluxppEngineImpl<52, p>> fImpl;
31 
32 public:
33  RanluxppEngine(uint64_t seed = 314159265);
34  virtual ~RanluxppEngine();
35 
36  /// Generate a double-precision random number with 52 bits of randomness
37  double Rndm() override;
38  /// Generate a double-precision random number (non-virtual method)
39  double operator()();
40  /// Generate a random integer value with 52 bits
41  uint64_t IntRndm();
42 
43  /// Initialize and seed the state of the generator
44  void SetSeed(uint64_t seed);
45  /// Skip `n` random numbers without generating them
46  void Skip(uint64_t n);
47 
48  /// Get name of the generator
49  static const char *Name() { return "RANLUX++"; }
50 };
51 
54 
55 extern template class RanluxppEngine<24>;
56 extern template class RanluxppEngine<2048>;
57 
58 } // end namespace Math
59 } // end namespace ROOT
60 
61 #endif /* ROOT_Math_RanluxppEngine */
n
const Int_t n
Definition: legend1.C:16
ROOT::Math::RanluxppEngine::~RanluxppEngine
virtual ~RanluxppEngine()
ROOT::Math::RanluxppEngine::Skip
void Skip(uint64_t n)
Skip n random numbers without generating them.
Definition: RanluxppEngineImpl.cxx:199
ROOT::Math::RanluxppEngine::SetSeed
void SetSeed(uint64_t seed)
Initialize and seed the state of the generator.
Definition: RanluxppEngineImpl.cxx:193
ROOT::Math::TRandomEngine
Definition: TRandomEngine.h:19
ROOT::Math::RanluxppEngine::Rndm
double Rndm() override
Generate a double-precision random number with 52 bits of randomness.
Definition: RanluxppEngineImpl.cxx:163
TRandomEngine.h
ROOT::Math::RanluxppEngine::IntRndm
uint64_t IntRndm()
Generate a random integer value with 52 bits.
Definition: RanluxppEngineImpl.cxx:187
ROOT::Math::RanluxppEngine::fImpl
std::unique_ptr< RanluxppEngineImpl< 52, p > > fImpl
Definition: RanluxppEngine.h:30
ROOT::Math::RanluxppEngine::RanluxppEngine
RanluxppEngine(uint64_t seed=314159265)
Definition: RanluxppEngineImpl.cxx:154
ROOT::Math::RanluxppEngine::operator()
double operator()()
Generate a double-precision random number (non-virtual method)
Definition: RanluxppEngineImpl.cxx:169
ROOT::Math::RanluxppEngine::Name
static const char * Name()
Get name of the generator.
Definition: RanluxppEngine.h:49
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
Math
Namespace for new Math classes and functions.
ROOT::Math::RanluxppEngine
Implementation of the RANLUX++ generator.
Definition: RanluxppEngine.h:27