hej is hosted by Hepforge, IPPP Durham
HEJ 2.1.4
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 struct RNG {
21 using result_type = unsigned;
22
24 virtual double flat() = 0;
25
27 virtual result_type min() const = 0;
29 virtual result_type max() const = 0;
31 virtual result_type operator()() = 0;
32
33 virtual ~RNG() = default;
34 };
35
37 struct DefaultRNG : virtual RNG {
38 result_type min() const override {
39 return 0U;
40 }
41 result_type max() const override {
42 return std::numeric_limits<result_type>::max() - 1;
43 }
45 return flat()*std::numeric_limits<result_type>::max();
46 }
47 };
48} // namespace HEJ
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
Helper struct with default implementations.
Definition: RNG.hh:37
result_type min() const override
Minimum number that can be generated.
Definition: RNG.hh:38
result_type max() const override
Maximum number that can be generated.
Definition: RNG.hh:41
result_type operator()() override
Generate random number in [min(), max()].
Definition: RNG.hh:44
Interface for random number generator.
Definition: RNG.hh:19
virtual result_type operator()()=0
Generate random number in [min(), max()].
virtual result_type max() const =0
Maximum number that can be generated.
virtual ~RNG()=default
virtual result_type min() const =0
Minimum number that can be generated.
virtual double flat()=0
Generate random number in [0,1)
unsigned result_type
Random number type, see std::RandomNumberDistribution.
Definition: RNG.hh:21