hej is hosted by Hepforge, IPPP Durham
HEJ 2.2.2
High energy resummation for hadron colliders
Loading...
Searching...
No Matches
RNG.hh
Go to the documentation of this file.
1
12#pragma once
13
14#include <limits>
15
16namespace HEJ {
17
19 //
20 // See https://en.cppreference.com/w/cpp/named_req/UniformRandomBitGenerator
21 // for requirements.
22 struct RNG {
24 using result_type = unsigned;
25
27 virtual double flat() = 0;
28
30 constexpr static result_type min() {
31 return 0u;
32 }
33
35 constexpr static result_type max() {
36 return std::numeric_limits<result_type>::max() - 1;
37 }
38
41 return flat()*std::numeric_limits<result_type>::max();
42 }
43
44 virtual ~RNG() = default;
45 };
46} // namespace HEJ
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
Interface for random number generator.
Definition: RNG.hh:22
static constexpr result_type max()
Maximum number that can be generated.
Definition: RNG.hh:35
result_type operator()()
Generate random number in [min(), max()].
Definition: RNG.hh:40
static constexpr result_type min()
Minimum number that can be generated.
Definition: RNG.hh:30
virtual ~RNG()=default
virtual double flat()=0
Generate random number in [0,1)
unsigned result_type
Random number type, see std::RandomNumberDistribution.
Definition: RNG.hh:24