30template <std::
integral I>
35 throw std::invalid_argument(
"Minimum value must be smaller than maximum value.");
38 static std::mt19937 pseudoRandomGenerator{std::random_device{}()};
40 std::uniform_int_distribution<I> distribution(min, max);
42 return distribution(pseudoRandomGenerator);
61template <std::
integral I>
83template <std::
floating_po
int F>
84F decimal(F min, F max)
88 throw std::invalid_argument(
"Minimum value must be smaller than maximum value.");
91 static std::mt19937 pseudoRandomGenerator{std::random_device{}()};
92 std::uniform_real_distribution<F> distribution(min, max);
94 return distribution(pseudoRandomGenerator);
113template <std::
floating_po
int F>
116 return decimal<F>(
static_cast<F
>(0.), max);
136template <std::
floating_po
int F>
137F normalDistribution(F mean, F standardDeviation)
139 if (standardDeviation < 0 || standardDeviation == INFINITY || mean == INFINITY)
141 throw std::invalid_argument(
"Standard Deviation cannot be negative");
143 else if (standardDeviation == 0)
148 std::random_device randDev;
149 std::mt19937 PSRNG(randDev());
151 std::normal_distribution<F> dist(mean, standardDeviation);
176template <std::
floating_po
int F>
177F normalDistribution(F mean, F standardDeviation, F min, F max)
181 throw std::invalid_argument(
"min cannot be larger than max");
184 F
sample = normalDistribution(mean, standardDeviation);
190 else if (sample < min)
214FAKER_CXX_EXPORT std::string
hexadecimal(
unsigned length = 1, HexCasing casing = HexCasing::Lower,
215 HexPrefix prefix = HexPrefix::ZeroX);
230FAKER_CXX_EXPORT std::string
hexadecimal(std::optional<int> min = std::nullopt, std::optional<int> max = std::nullopt);
243FAKER_CXX_EXPORT std::string
octal(
unsigned length = 1);
258FAKER_CXX_EXPORT std::string
binary(
int length = 1);
274FAKER_CXX_EXPORT std::string
binary(
int min,
int max);
FAKER_CXX_EXPORT std::string hexadecimal(unsigned length=1, HexCasing casing=HexCasing::Lower, HexPrefix prefix=HexPrefix::ZeroX)
Generates a random decimal number in the given range, bounds included.