22 using container_t = std::vector<element_t>;
28 auto generator = crd::random_generator<element_t>(1, 20);
38 stream <<
"Random numbers : " << v <<
nl;
43 <<
" random numbers are generated" <<
flush;
46template<
typename ContainerType,
typename StopwatchType>
48 const ContainerType& container,
49 const StopwatchType& sw)
51 stream << index <<
"- Minimum: " << container.front()
52 <<
", Maximum: " << container.back()
53 <<
", Elapsed: " << sw.elapsed_time() <<
nl;
64 using container_t = std::vector<element_t>;
70 auto generator = crd::random_generator<element_t>(1, 100);
75 size_t size = 1'000'000;
76 size_t test_count = 5;
85 stream <<
"========== Serial Sort ==========" <<
nL;
86 for(
size_t i = 0; i < test_count; ++i)
88 auto sorted_container = v;
90 std::sort(sorted_container.begin(), sorted_container.end());
106 using container_t = std::vector<element_t>;
112 auto generator = crd::random_generator<element_t>(1, 100);
117 size_t size = 1'000'000;
118 size_t test_count = 5;
127 stream <<
"========== Parallel Sort ==========" <<
nL;
128 for(
size_t i = 0; i < test_count; ++i)
130 auto sorted_container = v;
132 std::sort(std::execution::par_unseq, sorted_container.begin(), sorted_container.end());
void examples_for_random_stopwatch()
void examples_for_parallel_sort()
void print_constainer(size_t index, const ContainerType &container, const StopwatchType &sw)
void examples_for_serial_sort()
tpf::chrono_random::stop_watch stop_watch
void random_fill(Type(&container)[N], RandomGeneratorType const &random_generator)
Implements random number generator and stop watch.
ContainerType< EleType > sort(ContainerType< EleType, Types... > container, sort_order order=sort_order::ascending, sort_method method=sort_method::size)
Stream output operators << are implemented.