The code below show how to random double in C++11. In this solution each time, when I run this program the result are the same - I don't know why? How to change it to get different solution in every time when I run the program?
#include <random>
int main(int argc, char **argv)
{
double lower_bound = 0.;
double upper_bound = 1.;
std::uniform_real_distribution<double> unif(lower_bound, upper_bound);
std::default_random_engine re;
double a_random_double = unif(re);
cout << a_random_double << endl;
return 0;
}
//compilation: "g++ -std=c++0x program_name.cpp -o program_name"