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());
85 std::for_each(returnArray.
begin(),
87 [&generator, &dist](dtype& value) ->
void { value = dist(generator); });
103 template<
typename dtype>
121 template<
typename dtype>
#define STATIC_ASSERT_INTEGER(dtype)
Definition StaticAsserts.hpp:43
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
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
Definition Random/bernoulli.hpp:43
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
std::mt19937_64 generator_
generator function
Definition generator.hpp:35