Login Languish
random_utils.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <vector>
11 #include <random>
12 
13 namespace rand_utils {
14  int randomInt(int min, int max);
15 
16  size_t randomSizeT(size_t min, size_t max);
17  size_t randomSizeT(size_t max);
18 
19  template <typename T> void shuffle(std::vector<T> &vector) {
20  std::random_device rd;
21  std::mt19937 gen(rd());
22  std::shuffle(vector.begin(), vector.end(), gen);
23  }
24 }
size_t randomSizeT(size_t min, size_t max)
retrieves a pseudo-random size_t
Definition: random_utils.cpp:33
int randomInt(int min, int max)
retrieves a pseudo-random integer
Definition: random_utils.cpp:19
Definition: random_utils.cpp:12