#include #include #include #include #include #include #include #include using namespace std; class timer { public: timer() : start_timing(hi_res_clock::now()) {} void reset() { start_timing = hi_res_clock::now(); } double elapsed() const { return(std::chrono::duration_cast (hi_res_clock::now() - start_timing).count()); } private: typedef std::chrono::high_resolution_clock hi_res_clock; typedef std::chrono::duration > second_; std::chrono::time_point start_timing; }; void print_time(const string & heading , const double & t) { // Right justifies to column 30 const int nb=30; int n; int i; int l; l = heading.length(); if ( l >= nb ) cout << " Warning heading too long. Reduce to less than 30 characters" << endl; n=nb-l; cout << heading ; for (i=1;i x; int i; int j; double t; default_random_engine random_engine; uniform_int_distribution integer_random(1,INT_MAX); timer timer_01; timer timer_02; heading = "Program starts"; t=timer_01.elapsed(); print_time( heading , t); cout << " Problem size = " << x.size() << endl; heading = "default_random_engine"; for (j=0;j