53 template<
typename dtype,
typename GeneratorType = std::mt19937>
58 std::discrete_distribution<dtype> dist(inWeights.
cbegin(), inWeights.
cend());
59 return dist(generator);
75 template<
typename dtype,
typename GeneratorType = std::mt19937>
82 std::discrete_distribution<dtype> dist(inWeights.
cbegin(), inWeights.
cend());
84 std::for_each(returnArray.
begin(),
86 [&generator, &dist](dtype& value) ->
void { value = dist(generator); });
102 template<
typename dtype>
120 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:135
const_iterator cbegin() const noexcept
Definition NdArrayCore.hpp:1361
iterator end() noexcept
Definition NdArrayCore.hpp:1619
const_iterator cend() const noexcept
Definition NdArrayCore.hpp:1669
iterator begin() noexcept
Definition NdArrayCore.hpp:1311
A Shape Class for NdArrays.
Definition Core/shape.hpp:41
Definition Random/bernoulli.hpp:41
dtype discrete(GeneratorType &generator, const NdArray< double > &inWeights)
Definition discrete.hpp:54
Definition Random/bernoulli.hpp:39
dtype discrete(const NdArray< double > &inWeights)
Definition discrete.hpp:103
std::mt19937_64 generator_
generator function
Definition generator.hpp:35