Base template class for random with thread_local API and thread_local internal member storage.
More...
|
| static constexpr Engine::result_type | min () |
| |
| static constexpr Engine::result_type | max () |
| |
|
static void | discard (const unsigned long long z) |
| | Advances the internal state by z times.
|
| |
|
static void | reseed () |
| | Reseed by Seeder.
|
| |
| static void | seed (const typename Engine::result_type value=Engine::default_seed) |
| | Reinitializes the internal state of the random-number engine using new seed value.
|
| |
| template<typename Sseq > |
| static void | seed (Sseq &seq) |
| | Reinitializes the internal state of the random-number engine using new seed value.
|
| |
|
static Engine::result_type | get () |
| | return random number from engine in [min(), max()] range
|
| |
| static bool | is_equal (const Engine &other) |
| | Compares internal pseudo-random number engine with 'other' pseudo-random number engine. Two engines are equal, if their internal states are equivalent, that is, if they would generate equivalent values for any number of calls of operator()
|
| |
| template<typename CharT , typename Traits > |
| static void | serialize (std::basic_ostream< CharT, Traits > &ost) |
| | Serializes the internal state of the internal pseudo-random number engine as a sequence of decimal numbers separated by one or more spaces, and inserts it to the stream ost. The fill character and the formatting flags of the stream are ignored and unaffected.
|
| |
| template<typename CharT , typename Traits > |
| static void | deserialize (std::basic_istream< CharT, Traits > &ist) |
| | Restores the internal state of the internal pseudo-random number engine from the serialized representation, which was created by an earlier call to 'serialize' using a stream with the same imbued locale and the same CharT and Traits. If the input cannot be deserialized, internal engine is left unchanged and failbit is raised on ist.
|
| |
| template<typename T > |
| static std::enable_if< details::is_uniform_int< T >::value, T >::type | get (T from=std::numeric_limits< T >::min(), T to=std::numeric_limits< T >::max()) |
| | Generate a random integer number in a [from; to] range by std::uniform_int_distribution.
|
| |
| template<typename T > |
| static std::enable_if< details::is_uniform_real< T >::value, T >::type | get (T from=std::numeric_limits< T >::min(), T to=std::numeric_limits< T >::max()) |
| | Generate a random real number in a [from; to] range by std::uniform_real_distribution.
|
| |
| template<typename T > |
| static std::enable_if< details::is_byte< T >::value, T >::type | get (T from=std::numeric_limits< T >::min(), T to=std::numeric_limits< T >::max()) |
| | Generate a random byte number in a [from; to] range.
|
| |
| template<typename Key , typename A , typename B , typename C = typename std::common_type<A, B>::type> |
| static std::enable_if< std::is_same< Key, common >::value &&details::is_supported_number< A >::value &&details::is_supported_number< B >::value &&std::is_signed< A >::value!=std::is_unsigned< B >::value, C >::type | get (A from=std::numeric_limits< A >::min(), B to=std::numeric_limits< B >::max()) |
| | Generate a random common_type number in a [from; to] range.
|
| |
| template<typename T > |
| static std::enable_if< details::is_supported_character< T >::value, T >::type | get (T from=std::numeric_limits< T >::min(), T to=std::numeric_limits< T >::max()) |
| | Generate a random character in a [from; to] range by std::uniform_int_distribution.
|
| |
| template<typename T > |
| static std::enable_if< std::is_same< T, bool >::value, bool >::type | get (const double probability=0.5) |
| | Generate a bool value with specific probability by std::bernoulli_distribution.
|
| |
| template<typename T > |
| static T | get (std::initializer_list< T > init_list) |
| | Return random value from initilizer_list.
|
| |
| template<typename InputIt > |
| static std::enable_if< details::is_iterator< InputIt >::value, InputIt >::type | get (InputIt first, InputIt last) |
| | Return random iterator from iterator range.
|
| |
| template<typename Container > |
| static auto | get (Container &container) -> typename std::enable_if< details::is_iterator< decltype(std::begin(container))>::value, decltype(std::begin(container)) >::type |
| | Return random iterator from Container.
|
| |
| template<template< typename... > class Container, typename A > |
| static std::enable_if< details::has_reserve< Container< A > >::value, Container< A > >::type | get (A from, A to, std::size_t size) |
| | Return container filled with random values.
|
| |
| template<template< typename... > class Container, typename Key , typename A , typename B , typename C = typename std::common_type<A, B>::type> |
| static std::enable_if< std::is_same< Key, common >::value &&details::has_reserve< Container< A > >::value, Container< C > >::type | get (A start, B end, std::size_t size) |
| | Return container filled with random common_type values.
|
| |
| template<template< typename... > class Container, typename A > |
| static std::enable_if<!details::has_reserve< Container< A > >::value, Container< A > >::type | get (A start, A end, std::size_t size) |
| | Return container filled with random values.
|
| |
| template<template< typename... > class Container, typename Key , typename A , typename B , typename C = typename std::common_type<A, B>::type> |
| static std::enable_if< std::is_same< Key, common >::value &&!details::has_reserve< Container< C > >::value, Container< C > >::type | get (A start, B end, std::size_t size) |
| | Return container filled with random common_type values.
|
| |
| template<template< typename AA, std::size_t NN, typename... > class Container, std::size_t N, typename A > |
| static std::enable_if<!details::has_insert< Container< A, N > >::value, Container< A, N > >::type | get (A start, A end) |
| | Return array-like container filled with random values.
|
| |
| template<template< typename AA, std::size_t NN, typename... > class Container, std::size_t N, typename Key , typename A , typename B , typename C = typename std::common_type<A, B>::type> |
| static std::enable_if< std::is_same< Key, common >::value &&!details::has_insert< Container< C, N > >::value, Container< C, N > >::type | get (A start, B end) |
| | Return array-like container filled with random common_type values.
|
| |
| template<typename T , std::size_t N> |
| static T * | get (T(&array)[N]) |
| | Return random pointer from built-in array.
|
| |
| template<typename Dist , typename... Args> |
| static Dist::result_type | get (Args &&... args) |
| | Return value from custom Dist distribution seeded by internal random engine.
|
| |
| template<typename Dist > |
| static Dist::result_type | get (Dist &dist) |
| | Return value from custom 'dist' distribution seeded by internal random engine.
|
| |
| template<typename RandomIt > |
| static void | shuffle (RandomIt first, RandomIt last) |
| | Reorders the elements in the given range [first, last) such that each possible permutation of those elements has equal probability of appearance.
|
| |
| template<typename Container > |
| static void | shuffle (Container &container) |
| | Reorders the elements in the given container such that each possible permutation of those elements has equal probability of appearance.
|
| |
|
static Engine | get_engine () |
| | return internal engine by copy
|
| |
|
static Engine & | engine () |
| | return internal engine by ref
|
| |
template<typename Engine, typename Seeder = seeder_default, template< typename > class IntegerDist = std::uniform_int_distribution, template< typename > class RealDist = std::uniform_real_distribution, typename BoolDist = std::bernoulli_distribution>
class effolkronium::basic_random_thread_local< Engine, Seeder, IntegerDist, RealDist, BoolDist >
Base template class for random with thread_local API and thread_local internal member storage.
- Note
- it IS thread safe but less efficient then basic_random_static
- Parameters
-
| Engine | A random engine with interface like in the std::mt19937 |
| Seeder | A seeder type which return seed for internal engine through operator() |