8 #ifndef SIG_UTIL_RANDOM_HPP
9 #define SIG_UTIL_RANDOM_HPP
11 #include "../helper/container_traits.hpp"
30 template <
class T,
class Engine = std::mt19937>
33 mutable Engine engine_;
35 mutable typename std::conditional <
36 std::is_integral<T>::value,
37 std::uniform_int_distribution<T>,
38 std::uniform_real_distribution<T>
50 std::random_device rnd;
51 std::vector<unsigned long> v(10);
52 if (debug) std::fill(v.begin(), v.end(), 0);
53 else std::generate(v.begin(), v.end(), std::ref(rnd));
54 std::seed_seq seq(v.begin(), v.end());
64 return dist_(engine_);
84 template <
class C = std::vector<
int>>
87 std::unordered_set<int> match;
92 for (uint i = 0; i < n; ++i){
95 }
while (match.find(r) != match.end());
C make_unique_numbers(uint n, int min, int max, bool debug)
重複の無い一様分布の整数乱数を生成
SimpleRandom(T min, T max, bool debug)
コンストラクタ
初期化時に指定した範囲の一様分布乱数を発生させるクラス
T operator()() const
乱数を発生させて取得