As a complete beginner to C++, I would like to generate a random number from a normal distribution.
With the following code (derived from this post), I am able to d
Use a seed to initialize your generator. Here I am using a time-based seed.
#include
#include
#include
using namespace std;
int main()
{
unsigned seed = chrono::system_clock::now().time_since_epoch().count();
default_random_engine generator(seed);
normal_distribution distribution(0.0, 1.0);
cout << distribution(generator);
return 0;
}