When you modified the example to remove std::random_device
, you changed:
std::mt19937 gen(rd());
which declares a object of type std::mt19937
named gen
to:
std::mt19937 gen();
which is an instance of the dreaded "most vexing parse", so gen
is a function declaration instead of a declaration of an mt19937
object.
Change that line of code to: std::mt19937 gen;