I have a function that generates random integers and the first integer that it generates is always really small compared to the rest, and I don't understand why.
in fact, the output should be allways the same at the moment...
You need to seed your default_random_engine, otherwise you'll allways get the same result. std::chrono::system_clock::now().time_since_epoch().count() is the C++11 way of doing this
using srand(time(0)) and rand() are for older standards
C++11-way
1 2 3 4 5
#include <chrono>
// ...
Rand_int(int low, int high) : re(std::chrono::system_clock::now().time_since_epoch().count()), dist{ low, high } {}
C++03-way:
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <ctime>
#include <cstdlib>
// ...
Rand_int(int low, int high) : re(rand()), dist{ low, high } {}
// ...
int main() {
srand(time(0));
// ...
}