52 template<
typename GeneratorType = std::mt19937>
53 bool bernoulli(GeneratorType& generator,
double inP = 0.5)
55 if (inP < 0 || inP > 1)
60 std::bernoulli_distribution dist(inP);
61 return dist(generator);
74 template<
typename GeneratorType = std::mt19937>
77 if (inP < 0 || inP > 1)
84 std::bernoulli_distribution dist(inP);
88 [&generator, &dist](
bool& value) ->
void { value = dist(generator); });
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
iterator end() noexcept
Definition: NdArrayCore.hpp:1623
iterator begin() noexcept
Definition: NdArrayCore.hpp:1315
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
bool bernoulli(GeneratorType &generator, double inP=0.5)
Definition: Random/bernoulli.hpp:53
Definition: Random/bernoulli.hpp:41
bool bernoulli(double inP=0.5)
Definition: Random/bernoulli.hpp:101
static std::mt19937_64 generator_
generator function
Definition: generator.hpp:35
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition: StlAlgorithms.hpp:225