So, i'm attempting to generate a random number between 1 and 61 using an overloaded parenthetical operator, however for some reason every time I run my code, I keep getting the same result of 49.
Here's what I have:
double operator()() const
{
std::uniform_int_distribution<int> _uniformIntDistribution(1, 61);
std::default_random_engine _generator;
double result;
result = _uniformIntDistribution(_generator);
return result;
}
Not sure what i'm doing wrong. Any suggestions?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire