Question: C++ I have this code and I'm not quiet sure what is wrong with it, especially what random_device, default_random_engine, and normal_distribution are suppose to do.
C++
I have this code and I'm not quiet sure what is wrong with it, especially what random_device, default_random_engine, and normal_distribution are suppose to do. If someone could explain these few functions in simple words and point out what is wrong with it( why is it when I try to cout vector v it have nothing on it). Thnaks!
#include
#include
#include
#include
using namespace std;
constexpr int a = 10;
int main(int argc, char * argv[])
{
random_device dev{};
default_random_engine engine{ dev() };
normal_distribution dist{ 32, 2 };
vector v;
for (int i = 0; i >= a; ++i) v.push_back(dist(engine));
for (int i = 0; i < v.size(); ++i) cout << v.at(i);
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
