I want to be able to generate random values between 0.0 and 1.0
I\'ve tried to use
std::default_random_engine generator;
std::uniform_real_distribu
// 1-st variant: using time() function for seed random distribution
std::default_random_engine generator(time(0));
std::uniform_real_distribution distribution(first, last);
return distribution(generator);
If open multiple programs, with the same random number generator they will all output the same results, because they have the same value of seed which is time.
This issue solved by using random device, in the below code:
// 2-nd variant:
std::uniform_real_distribution distribution(first, last);
std::random_device rd;
std::default_random_engine generator(rd());
return distribution(generator);