#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <chrono>
using namespace std;
class Timer
{
using clock_t = std::chrono::high_resolution_clock;
using second_t = std::chrono::duration<double, std::ratio<1>>;
std::chrono::time_point<clock_t> start_time = clock_t::now();
public:
void elapsed()
{
std::chrono::time_point<clock_t> end_time = clock_t::now();
cout << std::chrono::duration_cast<second_t>(end_time - start_time).count() << "\n";
}
}
int main()
{
random_device rnd_device; //
mt19937 mersenne_engine{ rnd_device() }; // random generator
vector<int> vec(10);
for (unsigned int i=0; i<vec.size(); ++i)
vec[i] = i;
std::shuffle(begin(vec), end(vec), mersenne_engine); // shuffle
for (auto &e : vec) cout << e << " ";
cout << "\n";
Timer timer; // 생성자에서 start time 생김
std::sort(vec.begin(),vec.end());
timer.elapsed(); // 걸린 시간 반환
for (auto &e : vec) cout << e << " ";
cout << "\n";
return 0;
}