I just can't figure this problem out. Maybe my code is badly designed or there is simple way to do it.
What i want to to is to use the "uniform_int_distribution"-random generator in one of my header files. But because i need to declare these in my int main:
1 2
std::random_device rd;
std::mt19937 gen(rd());
the header file doesnt know anything about those... Is there a way to declare those in a header or something?
Can't you pass the std::mt19937 object as an argument to the functions? Make sure you pass it by reference because you probably don't want to create copies of the random generator.