Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F7879803
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
diff --git a/include/HEJ/RNG.hh b/include/HEJ/RNG.hh
index e31bda0..2f6af42 100644
--- a/include/HEJ/RNG.hh
+++ b/include/HEJ/RNG.hh
@@ -1,47 +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 {
using result_type = unsigned;
- //! Generate random number in (0,1]
+ //! 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
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Nov 19, 9:06 PM (1 d, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3797503
Default Alt Text
(1 KB)
Attached To
rHEJ HEJ
Event Timeline
Log In to Comment