55 template<
typename dtype,
typename GeneratorType = std::mt19937>
56 dtype
geometric(GeneratorType& generator,
double inP = 0.5)
60 if (inP < 0 || inP > 1)
65 std::geometric_distribution<dtype> dist(inP);
66 return dist(generator);
82 template<
typename dtype,
typename GeneratorType = std::mt19937>
87 if (inP < 0 || inP > 1)
94 std::geometric_distribution<dtype> dist(inP);
98 [&generator, &dist](dtype& value) ->
void { value = dist(generator); });
114 template<
typename dtype>
117 return detail::geometric<dtype>(
generator_, inP);
132 template<
typename dtype>
135 return detail::geometric<dtype>(
generator_, inShape, inP);
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
#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
iterator end() noexcept
Definition: NdArrayCore.hpp:1623
iterator begin() noexcept
Definition: NdArrayCore.hpp:1315
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
dtype geometric(GeneratorType &generator, double inP=0.5)
Definition: geometric.hpp:56
Definition: Random/bernoulli.hpp:41
dtype geometric(double inP=0.5)
Definition: geometric.hpp:115
static std::mt19937_64 generator_
generator function
Definition: generator.hpp:35
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition: StlAlgorithms.hpp:225