cauldron  0.0.0
 All Classes Namespaces Files Functions Variables Typedefs
integers.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <limits>
4 
5 #include "bases.h"
6 
7 
8 namespace cauldron {
13 template<typename Value>
14 class Integers : public CloneHelper<Value, Integers<Value>> {
15  static_assert(std::is_integral<Value>(),
16  "``Value`` should be integral type.");
17  static_assert(!std::is_same<Value, bool>(),
18  "``Value`` should not be ``bool`` type, "
19  "use ``strategies::Booleans`` instead.");
20  public:
25  explicit Integers(Value min_value = std::numeric_limits<Value>::min(),
26  Value max_value = std::numeric_limits<Value>::max())
27  : min_value_(min_value),
28  max_value_(max_value) {};
29 
33  Value operator()() const override {
34  static std::random_device random_device;
35  std::uniform_int_distribution<Value> distribution(min_value_, max_value_);
36  return distribution(random_device);
37  }
38 
39  private:
40  Value min_value_;
41  Value max_value_;
42 };
43 }
Integers(Value min_value=std::numeric_limits< Value >::min(), Value max_value=std::numeric_limits< Value >::max())
Definition: integers.h:25
Definition: bases.h:97
Definition: integers.h:14
Value operator()() const override
Definition: integers.h:33