Generate 2,000,000 normally distributed random numbers using the Box-Muller's method.
I'm pretty new to coding and worked through this with a friend but I'm not sure if I got it right. Thanks
int main()
{
const int nrolls=10; // number of experiments
const int nstars=10; // maximum number of stars to distribute
To be an acceptable solution for a homework assignment, your code needs to make use of the concepts taught in class. Random programmers on the internet can't tell if it does.
unless the standard library imlementation of std::normal_distribution::operator() does, which is unlikely: both GNU and LLVM seem to be using Marsaglia method internally.
Supposedly c++11 uses the box-muller. The internet said so, so it must be correct :)
The above looks correct. There are several similar implementations on the web and they generally look like what you did. Ill leave it to you to compare what you have against what is out there and determine the correctness.