Page MenuHomeHEPForge

No OneTemporary

diff --git a/include/HEJ/RNG.hh b/include/HEJ/RNG.hh
index cfa5f9b..e31bda0 100644
--- a/include/HEJ/RNG.hh
+++ b/include/HEJ/RNG.hh
@@ -1,46 +1,47 @@
/** \file
* \brief Interface for pseudorandom number generators
*
* We select our random number generator at runtime according to the
* configuration file. This interface guarantees that we can use all
* generators in the same way.
*
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#pragma once
#include <limits>
namespace HEJ {
//! Interface for random number generator
struct RNG {
- typedef unsigned result_type;
+ using result_type = unsigned;
+
//! Generate random number in (0,1]
virtual double flat() = 0;
//! Minimum number that can be generated
virtual result_type min() const = 0;
//! Maximum number that can be generated
virtual result_type max() const = 0;
//! Generate random number in [min(), max()]
virtual result_type operator()() = 0;
virtual ~RNG() = default;
};
//! Helper struct with default implementations
struct DefaultRNG : virtual RNG {
result_type min() const override {
return 0u;
}
result_type max() const override {
return std::numeric_limits<result_type>::max() - 1;
}
result_type operator()() override {
return flat()*std::numeric_limits<result_type>::max();
}
};
} // namespace HEJ

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 2:56 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3797568
Default Alt Text
(1 KB)

Event Timeline