53 std::random_device rd;
58 std::seed_seq seq{seed};
60 std::vector<std::uint32_t> seeds(
rg.size());
61 seq.generate(seeds.begin(), seeds.end());
63 for (
size_t i = 0; i <
rg.size(); ++i) {
70 std::uniform_int_distribution<> dist( lowerLimit, upperLimit );
76 std::uniform_real_distribution<float> dist(min, max);
82 std::uniform_real_distribution<float> dist(min, max);
102 v1=float(2.0*
rnd_flt(-1,1)-1.0);
103 v2=float(2.0*
rnd_flt(-1,1)-1.0);
105 }
while (rsq >= 1.0 || rsq == 0.0);
106 fac=float(sqrt(-2.0*log(rsq)/rsq));
123 vector<size_t> idx(n);
124 std::iota(idx.begin(), idx.end(), 0);
125 this->
shuffle(idx.begin(), idx.end());
Defines a multi-core random number generator and its operators.
void shuffle(RandomAccessIterator first, RandomAccessIterator last)
float rnd_flt(float min=0.0, float max=1.0)
vector< size_t > shuffled_index(size_t n)
returns a shuffled index vector of length n
void set_seed(unsigned int seed)
vector< std::mt19937 > rg
float rnd_dbl(float min=0.0, float max=1.0)
int rnd_int(int lowerLimit, int upperLimit)
#define omp_get_max_threads()
#define omp_get_thread_num()
namespace containing various utility functions
< nsga2 selection operator for getting the front