Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
20namespace ROOT {
21namespace Math {
22
23template <int w, int p>
24class RanluxppEngineImpl;
25
26template <int p>
27class RanluxppEngine final : public TRandomEngine {
28
29private:
30 std::unique_ptr<RanluxppEngineImpl<48, p>> fImpl;
31
32public:
33 RanluxppEngine(uint64_t seed = 314159265);
34 virtual ~RanluxppEngine();
35
36 /// Generate a double-precision random number with 48 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 48 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
55extern template class RanluxppEngine<24>;
56extern template class RanluxppEngine<2048>;
57
58} // end namespace Math
59} // end namespace ROOT
60
61#endif /* ROOT_Math_RanluxppEngine */
Implementation of the RANLUX++ generator.
uint64_t IntRndm()
Generate a random integer value with 48 bits.
std::unique_ptr< RanluxppEngineImpl< 48, p > > fImpl
double Rndm() override
Generate a double-precision random number with 48 bits of randomness.
void Skip(uint64_t n)
Skip n random numbers without generating them.
void SetSeed(uint64_t seed)
Initialize and seed the state of the generator.
double operator()()
Generate a double-precision random number (non-virtual method)
static const char * Name()
Get name of the generator.
const Int_t n
Definition legend1.C:16
Namespace for new Math classes and functions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...