54 template<
typename dtype,
typename GeneratorType = std::mt19937>
59 std::discrete_distribution<dtype> dist(inWeights.
cbegin(), inWeights.
cend());
60 return dist(generator);
76 template<
typename dtype,
typename GeneratorType = std::mt19937>
83 std::discrete_distribution<dtype> dist(inWeights.
cbegin(), inWeights.
cend());
87 [&generator, &dist](dtype& value) ->
void { value = dist(generator); });
103 template<
typename dtype>
106 return detail::discrete<dtype>(
generator_, inWeights);
121 template<
typename dtype>
124 return detail::discrete<dtype>(
generator_, inShape, inWeights);
#define STATIC_ASSERT_INTEGER(dtype)
Definition: StaticAsserts.hpp:43
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1365
iterator end() noexcept
Definition: NdArrayCore.hpp:1623
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1673
iterator begin() noexcept
Definition: NdArrayCore.hpp:1315
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
dtype discrete(GeneratorType &generator, const NdArray< double > &inWeights)
Definition: discrete.hpp:55
Definition: Random/bernoulli.hpp:41
dtype discrete(const NdArray< double > &inWeights)
Definition: discrete.hpp:104
static std::mt19937_64 generator_
generator function
Definition: generator.hpp:35
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition: StlAlgorithms.hpp:225