![]() |
C++ Library Extensions 2022.12.09
To help learn modern C++ programming
|
Implements random number generator and stop watch. More...
Classes | |
class | fair_dice |
class | random_t |
class | random_words |
class | stop_watch |
Typedefs | |
using | nano_t = std::nano |
using | micro_t = std::micro |
using | milli_t = std::milli |
using | second_t = std::ratio< 1 > |
using | minute_t = std::ratio< 60 > |
using | hour_t = std::ratio< 3600 > |
template<typename TimeUnit > | |
using | duration_t = std::chrono::duration< double, TimeUnit > |
using | nanoseconds_t = duration_t< nano_t > |
using | microseconds_t = duration_t< micro_t > |
using | milliseconds_t = duration_t< milli_t > |
using | seconds_t = duration_t< second_t > |
using | minutes_t = duration_t< minute_t > |
using | hours_t = duration_t< hour_t > |
using | high_resolution_clock_t = std::chrono::high_resolution_clock |
using | time_point_t = std::chrono::time_point< high_resolution_clock_t > |
using | random_engine_t = std::default_random_engine |
template<std::integral IntegralType> | |
using | random_uniform_integral_distribution = std::uniform_int_distribution< IntegralType > |
template<std::floating_point RealType> | |
using | random_uniform_real_distribution = std::uniform_real_distribution< RealType > |
template<std::integral IntegralType> | |
using | random_uniform_integer_t = random_t< IntegralType, random_uniform_integral_distribution< IntegralType >, random_engine_t > |
template<std::floating_point RealType> | |
using | random_uniform_real_t = random_t< RealType, random_uniform_real_distribution< RealType >, random_engine_t > |
Functions | |
unsigned int | seed () |
unsigned int | get_current_tick () |
template<typename TimeUnit > | |
double | time_difference_in_unit (const time_point_t &start_time, const time_point_t &end_time) |
template<typename ValueType , typename RangeType1 , typename RangeType2 > | |
auto | random_generator (RangeType1 range_start, RangeType2 range_end) |
template<typename Type , std::size_t N, typename RandomGeneratorType > | |
void | random_fill (Type(&container)[N], RandomGeneratorType const &random_generator) |
template<typename Type , std::size_t M, std::size_t N, typename RandomGeneratorType > | |
void | random_fill (Type(&container)[M][N], RandomGeneratorType const &random_generator) |
template<typename Type , std::size_t L, std::size_t M, std::size_t N, typename RandomGeneratorType > | |
void | random_fill (Type(&container)[L][M][N], RandomGeneratorType const &random_generator) |
template<template< typename, typename... > class ContainerType, typename Type , typename... Types, typename RType , template< typename, typename... > class RandomGeneratorType, typename... RTypes> | |
void | random_fill (ContainerType< Type, Types... > &container, const RandomGeneratorType< RType, RTypes... > &random_generator) |
template<template< typename, typename... > class ContainerType, typename Type , typename... Types, typename RandomGeneratorType > | |
void | random_fill (ContainerType< Type, Types... > &container, RandomGeneratorType &&random_generator) |
template<template< typename, typename... > class ContainerType, typename Type , typename... Types, typename RangeType > | |
void | random_fill (ContainerType< Type, Types... > &container, RangeType range_start, RangeType range_end) |
template<template< typename, std::size_t > class ContainerType, typename Type , std::size_t N, typename RType , template< typename, typename... > class RandomGeneratorType, typename... RTypes> | |
void | random_fill (ContainerType< Type, N > &container, const RandomGeneratorType< RType, RTypes... > &random_generator) |
template<template< typename, std::size_t > class ContainerType, typename Type , std::size_t N, typename RandomGeneratorType > | |
void | random_fill (ContainerType< Type, N > &container, RandomGeneratorType &&random_generator) |
template<template< typename, std::size_t > class ContainerType, typename Type , std::size_t N, typename RangeType > | |
void | random_fill (ContainerType< Type, N > &container, RangeType range_start, RangeType range_end) |
template<typename Type , std::size_t N, template< typename, typename... > class RandomGeneratorType, typename RType , typename... RTypes> | |
void | random_parallel_fill (Type(&container)[N], const RandomGeneratorType< RType, RTypes... > &random_generator) |
template<typename Type , std::size_t M, std::size_t N, template< typename, typename... > class RandomGeneratorType, typename RType , typename... RTypes> | |
void | random_parallel_fill (Type(&container)[M][N], const RandomGeneratorType< RType, RTypes... > &random_generator) |
template<typename Type , std::size_t L, std::size_t M, std::size_t N, template< typename, typename... > class RandomGeneratorType, typename RType , typename... RTypes> | |
void | random_parallel_fill (Type(&container)[L][M][N], const RandomGeneratorType< RType, RTypes... > &random_generator) |
template<template< typename, typename... > class ContainerType, typename Type , typename... Types, typename RType , template< typename, typename... > class RandomGeneratorType, typename... RTypes> | |
void | random_parallel_fill (ContainerType< Type, Types... > &container, const RandomGeneratorType< RType, RTypes... > &random_generator) |
template<template< typename, typename... > class ContainerType, typename Type , typename... Types, typename RandomGeneratorType > | |
void | random_parallel_fill (ContainerType< Type, Types... > &container, RandomGeneratorType &&random_generator) |
template<template< typename, typename... > class ContainerType, typename Type , typename... Types, typename RangeType > | |
void | random_parallel_fill (ContainerType< Type, Types... > &container, RangeType range_start, RangeType range_end) |
template<template< typename, std::size_t > class ContainerType, typename Type , std::size_t N, typename RType , template< typename, typename... > class RandomGeneratorType, typename... RTypes> | |
void | random_parallel_fill (ContainerType< Type, N > &container, const RandomGeneratorType< RType, RTypes... > &random_generator) |
template<template< typename, std::size_t > class ContainerType, typename Type , std::size_t N, typename RandomGeneratorType > | |
void | random_parallel_fill (ContainerType< Type, N > &container, RandomGeneratorType &&random_generator) |
template<template< typename, std::size_t > class ContainerType, typename Type , std::size_t N, typename RangeType > | |
void | random_parallel_fill (ContainerType< Type, N > &container, RangeType range_start, RangeType range_end) |
template<template< typename, typename... > class ContainerType, typename Type , typename... Types, typename SizeType , template< typename, typename... > class RandomGeneratorType, typename... RTypes> | |
void | random_fill (ContainerType< Type, Types... > &container, const RandomGeneratorType< Type, RTypes... > &random_generator, SizeType size) |
Fills the /a container with random numbers. If the /a container is /a set or /a unordered_set, the range of the random_generator should be sufficiently big, otherwise it can fall into infinity loop. More... | |
template<typename Type , size_t ArraySize> | |
random_words (int, int, int, const Type(&)[ArraySize]) -> random_words< Type, ArraySize > | |
Variables | |
auto & | now = high_resolution_clock_t::now |
Implements random number generator and stop watch.
using cpg::chrono_random::duration_t = typedef std::chrono::duration<double, TimeUnit> |
Definition at line 62 of file cpg_chrono_random.hpp.
using cpg::chrono_random::high_resolution_clock_t = typedef std::chrono::high_resolution_clock |
Definition at line 71 of file cpg_chrono_random.hpp.
using cpg::chrono_random::hour_t = typedef std::ratio<3600> |
Definition at line 59 of file cpg_chrono_random.hpp.
using cpg::chrono_random::hours_t = typedef duration_t<hour_t> |
Definition at line 69 of file cpg_chrono_random.hpp.
using cpg::chrono_random::micro_t = typedef std::micro |
Definition at line 55 of file cpg_chrono_random.hpp.
using cpg::chrono_random::microseconds_t = typedef duration_t<micro_t> |
Definition at line 65 of file cpg_chrono_random.hpp.
using cpg::chrono_random::milli_t = typedef std::milli |
Definition at line 56 of file cpg_chrono_random.hpp.
using cpg::chrono_random::milliseconds_t = typedef duration_t<milli_t> |
Definition at line 66 of file cpg_chrono_random.hpp.
using cpg::chrono_random::minute_t = typedef std::ratio<60> |
Definition at line 58 of file cpg_chrono_random.hpp.
using cpg::chrono_random::minutes_t = typedef duration_t<minute_t> |
Definition at line 68 of file cpg_chrono_random.hpp.
using cpg::chrono_random::nano_t = typedef std::nano |
Definition at line 54 of file cpg_chrono_random.hpp.
using cpg::chrono_random::nanoseconds_t = typedef duration_t<nano_t> |
Definition at line 64 of file cpg_chrono_random.hpp.
using cpg::chrono_random::random_engine_t = typedef std::default_random_engine |
Definition at line 114 of file cpg_chrono_random.hpp.
using cpg::chrono_random::random_uniform_integer_t = typedef random_t<IntegralType, random_uniform_integral_distribution<IntegralType>, random_engine_t> |
Definition at line 258 of file cpg_chrono_random.hpp.
using cpg::chrono_random::random_uniform_integral_distribution = typedef std::uniform_int_distribution<IntegralType> |
Definition at line 117 of file cpg_chrono_random.hpp.
using cpg::chrono_random::random_uniform_real_distribution = typedef std::uniform_real_distribution<RealType> |
Definition at line 121 of file cpg_chrono_random.hpp.
using cpg::chrono_random::random_uniform_real_t = typedef random_t<RealType, random_uniform_real_distribution<RealType>, random_engine_t> |
Definition at line 262 of file cpg_chrono_random.hpp.
using cpg::chrono_random::second_t = typedef std::ratio<1> |
Definition at line 57 of file cpg_chrono_random.hpp.
using cpg::chrono_random::seconds_t = typedef duration_t<second_t> |
Definition at line 67 of file cpg_chrono_random.hpp.
using cpg::chrono_random::time_point_t = typedef std::chrono::time_point<high_resolution_clock_t> |
Definition at line 72 of file cpg_chrono_random.hpp.
unsigned int cpg::chrono_random::get_current_tick | ( | ) |
Definition at line 79 of file cpg_chrono_random.hpp.
void cpg::chrono_random::random_fill | ( | ContainerType< Type, N > & | container, |
const RandomGeneratorType< RType, RTypes... > & | random_generator | ||
) |
void cpg::chrono_random::random_fill | ( | ContainerType< Type, N > & | container, |
RandomGeneratorType && | random_generator | ||
) |
void cpg::chrono_random::random_fill | ( | ContainerType< Type, N > & | container, |
RangeType | range_start, | ||
RangeType | range_end | ||
) |
void cpg::chrono_random::random_fill | ( | ContainerType< Type, Types... > & | container, |
const RandomGeneratorType< RType, RTypes... > & | random_generator | ||
) |
void cpg::chrono_random::random_fill | ( | ContainerType< Type, Types... > & | container, |
const RandomGeneratorType< Type, RTypes... > & | random_generator, | ||
SizeType | size | ||
) |
Fills the /a container with random numbers. If the /a container is /a set or /a unordered_set, the range of the random_generator should be sufficiently big, otherwise it can fall into infinity loop.
ContainerType | |
Type | |
Types | |
SizeType | |
RandomGeneratorType | |
RTypes |
container | |
random_generator | |
size |
Definition at line 675 of file cpg_chrono_random.hpp.
void cpg::chrono_random::random_fill | ( | ContainerType< Type, Types... > & | container, |
RandomGeneratorType && | random_generator | ||
) |
void cpg::chrono_random::random_fill | ( | ContainerType< Type, Types... > & | container, |
RangeType | range_start, | ||
RangeType | range_end | ||
) |
void cpg::chrono_random::random_fill | ( | Type(&) | container[L][M][N], |
RandomGeneratorType const & | random_generator | ||
) |
void cpg::chrono_random::random_fill | ( | Type(&) | container[M][N], |
RandomGeneratorType const & | random_generator | ||
) |
void cpg::chrono_random::random_fill | ( | Type(&) | container[N], |
RandomGeneratorType const & | random_generator | ||
) |
Definition at line 344 of file cpg_chrono_random.hpp.
auto cpg::chrono_random::random_generator | ( | RangeType1 | range_start, |
RangeType2 | range_end | ||
) |
Definition at line 266 of file cpg_chrono_random.hpp.
void cpg::chrono_random::random_parallel_fill | ( | ContainerType< Type, N > & | container, |
const RandomGeneratorType< RType, RTypes... > & | random_generator | ||
) |
void cpg::chrono_random::random_parallel_fill | ( | ContainerType< Type, N > & | container, |
RandomGeneratorType && | random_generator | ||
) |
void cpg::chrono_random::random_parallel_fill | ( | ContainerType< Type, N > & | container, |
RangeType | range_start, | ||
RangeType | range_end | ||
) |
void cpg::chrono_random::random_parallel_fill | ( | ContainerType< Type, Types... > & | container, |
const RandomGeneratorType< RType, RTypes... > & | random_generator | ||
) |
void cpg::chrono_random::random_parallel_fill | ( | ContainerType< Type, Types... > & | container, |
RandomGeneratorType && | random_generator | ||
) |
void cpg::chrono_random::random_parallel_fill | ( | ContainerType< Type, Types... > & | container, |
RangeType | range_start, | ||
RangeType | range_end | ||
) |
void cpg::chrono_random::random_parallel_fill | ( | Type(&) | container[L][M][N], |
const RandomGeneratorType< RType, RTypes... > & | random_generator | ||
) |
void cpg::chrono_random::random_parallel_fill | ( | Type(&) | container[M][N], |
const RandomGeneratorType< RType, RTypes... > & | random_generator | ||
) |
void cpg::chrono_random::random_parallel_fill | ( | Type(&) | container[N], |
const RandomGeneratorType< RType, RTypes... > & | random_generator | ||
) |
Definition at line 439 of file cpg_chrono_random.hpp.
cpg::chrono_random::random_words | ( | int | , |
int | , | ||
int | , | ||
const | Type(&)[ArraySize] | ||
) | -> random_words< Type, ArraySize > |
|
inline |
double cpg::chrono_random::time_difference_in_unit | ( | const time_point_t & | start_time, |
const time_point_t & | end_time | ||
) |
Definition at line 92 of file cpg_chrono_random.hpp.
auto& cpg::chrono_random::now = high_resolution_clock_t::now |
Definition at line 73 of file cpg_chrono_random.hpp.