Problem Having trouble with <random> header

TheCanadianSkeptic

New member
Joined
Dec 11, 2021
Messages
1
Reaction score
0
Points
1
Location
ontario
I need to use "random_generator" in a separate class...

#include <random>
random_device rd;
mt19937 gen(rd());

class ranNumberGenerator
{
public:
float getRandomFloat(float lowerLimit, float upperLimit)
{
uniform_real_distribution<>dis(lowerLimit, upperLimit);
return (float)dis(gen);
}
};
ranNumberGenerator rNum;

I tested it's implementation in a console app, and it worked just fine.
However, when I try to use it in a Win32 (Windows) app, none of the functions in <random> register as valid in VS.

For example, intellisense won't recognize "random_device", which is a valid function in <random> as the test in console confirmed.

Is there a difference between the console and Win32 environments that I'm unaware of?

Thanks in advance.
 
Top