hej is hosted by Hepforge, IPPP Durham
HEJ 2 2.0
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 virtual double flat() = 0;
22
24 virtual unsigned min() const = 0;
26 virtual unsigned max() const = 0;
28 virtual unsigned operator()() = 0;
29
30 virtual ~RNG() = default;
31 };
32
34 struct DefaultRNG : virtual RNG {
35 unsigned min() const override {
36 return 0u;
37 }
38 unsigned max() const override {
39 return std::numeric_limits<unsigned>::max() - 1;
40 }
41 unsigned operator()() override {
42 return flat()*std::numeric_limits<unsigned int>::max();
43 }
44 };
45}
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
Helper struct with default implementations.
Definition: RNG.hh:34
unsigned max() const override
Maximum number that can be generated.
Definition: RNG.hh:38
unsigned operator()() override
Generate random number in [min(), max()].
Definition: RNG.hh:41
unsigned min() const override
Minimum number that can be generated.
Definition: RNG.hh:35
Interface for random number generator.
Definition: RNG.hh:19
virtual ~RNG()=default
virtual double flat()=0
Generate random number in (0,1].
virtual unsigned min() const =0
Minimum number that can be generated.
virtual unsigned operator()()=0
Generate random number in [min(), max()].
virtual unsigned max() const =0
Maximum number that can be generated.