Use <random> in a c++ class
问题 I want to use the <random> library in my program and I will have classes with different distributions and I want to generate a number at different times in my program. Currently I have the following in my header file #include <random> #include <time.h> class enemy { private: int max_roll; typedef std::mt19937 MyRng; MyRng rng; public: enemy(int MR){ max_roll = MR; rng.seed(time(NULL)); std::uniform_int_distribution<int> dice(1, max_roll); } int roll() { return dice(rng); } }; I'm getting the