Files
dofs/docs/core/rng.md

2.0 KiB

core/rng.h

Rng::Rng

explicit Rng(seed_type seed = default_seed()) noexcept : _eng(seed)

Rng::choose_weighted

template<typename T> template<typename T> T choose_weighted(const std::vector<std::pair<double, T>> &items)

Rng::choose_weighted

template<typename T> template<typename T> T choose_weighted(std::initializer_list<std::pair<double, T>> items)

Rng::poisson

std::uint64_t poisson(double lambda)

Rng::seed

void seed(seed_type s) noexcept

Rng::uniform01

double uniform01()

Rng::uniform_range

double uniform_range(double lo_inclusive, double hi_exclusive)

Rng::uniform_range

template<typename Int, typename = std::enable_if_t<std::is_integral<Int>::value>> template<typename Int, typename = std::enable_if_t<std::is_integral<Int>::value>> Int uniform_range(Int hi_exclusive)

Rng::uniform_range

template<typename Int, typename = std::enable_if_t<std::is_integral<Int>::value>> template<typename Int, typename = std::enable_if_t<std::is_integral<Int>::value>> Int uniform_range(Int lo_inclusive, Int hi_exclusive)

choose_weighted

template <typename T> T choose_weighted(const std::vector<std::pair<double, T>> &items){

choose_weighted

template <typename T> T choose_weighted(std::initializer_list<std::pair<double, T>> items){

choose_weighted_impl

return choose_weighted_impl(items.begin(), items.end());

choose_weighted_impl

return choose_weighted_impl(items.begin(), items.end());

choose_weighted_impl

template <typename Iter> auto choose_weighted_impl(Iter first, Iter last) -> typename std::iterator_traits<Iter>::value_type::second_type{

default_seed

static constexpr seed_type default_seed() noexcept{

dofs::seed

void seed(seed_type s) noexcept{

poisson

std::uint64_t poisson(double lambda){

uniform01

double uniform01(){

uniform_range

Int uniform_range(Int hi_exclusive){

uniform_range

Int uniform_range(Int lo_inclusive, Int hi_exclusive){

uniform_range

double uniform_range(double lo_inclusive, double hi_exclusive){