I'm learning c++ so it's a newbie question.
I what to put a random generator in a class because it is only used by the class.
To declare and to initialize a random numbers generator I use this piece of code:
Code:
std::random_device seed;
std::default_random_engine rand_gen(seed());
but putting that code in a class it gives an error, for example
Code:
class TBoard {
private:
std::random_device seed;
std::default_random_engine rand_gen(seed());
};
it's wrong. The solution I think is to put rand_gen(seed()) in the class constructor but I can't find the right solution. Could you help me? Thank you