14 template <
typename RandomGenerator = std::default_random_engine>
17 RandomGenerator& = RandomGenerator())
24 template <
typename... LabelSet,
25 typename RandomGenerator = std::default_random_engine>
26 typename tupleset<LabelSet...>::value_t
28 RandomGenerator& gen = RandomGenerator())
35 template <
typename... LabelSet,
37 typename RandomGenerator = std::default_random_engine>
38 typename tupleset<LabelSet...>::value_t
45 return ls.tuple(
random_label(ls.template set<I>(), gen)...);
50 template <
typename GenSet,
51 typename RandomGenerator = std::default_random_engine>
52 typename wordset<GenSet>::value_t
54 RandomGenerator& gen = RandomGenerator())
57 "random_label: the alphabet needs at least 1 letter");
58 auto dis = std::uniform_int_distribution<>(0, 5);
59 auto res_label = ls.
one();
68 template <
typename LabelSet,
69 typename RandomGenerator = std::default_random_engine>
70 typename LabelSet::value_t
72 RandomGenerator& gen = RandomGenerator())
74 require(!ls.generators().empty(),
75 "random_label: the alphabet needs at least 1 letter");
78 return ls.value(pick(ls.generators()));
83 template <
typename LabelSet,
84 typename RandomGenerator = std::default_random_engine>
85 typename nullableset<LabelSet>::value_t
87 RandomGenerator& gen = RandomGenerator())
90 auto dis = std::bernoulli_distribution(0.5);
99 template <
typename Context,
100 typename RandomGenerator = std::default_random_engine>
101 typename expressionset<Context>::value_t
103 RandomGenerator& gen = RandomGenerator())
value_t value(Args &&...args) const
auto mul(Args &&...args) const -> decltype(this->genset() -> mul(std::forward< Args >(args)...))
value_t value(Args &&...args) const
Value constructor.
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
Implementation of labels are nullables (letter or empty).
Implementation of labels are ones: there is a single instance of label.
static ATTRIBUTE_PURE constexpr value_t one()
const genset_t & generators() const
tupleset< LabelSet... >::value_t random_label_(const tupleset< LabelSet... > &ls, RandomGenerator &gen, detail::index_sequence< I... >)
Implementation detail for random label from tupleset.
weightset_mixin< detail::tupleset_impl< LabelSets... >> tupleset
oneset::value_t random_label(const oneset &ls, RandomGenerator &=RandomGenerator())
Random label from oneset.
Implementation of labels are words.
genset_t generators() const
The generators. Meaningful for labelsets only.
const labelset_ptr labelset() const
random_selector< RandomGenerator > make_random_selector(RandomGenerator &g)
Provide a variadic mul on top of a binary mul(), and one().
auto irange(Integer last)
Generate an integer range.