30template <std::
integral I>
35 throw std::invalid_argument(
"Minimum value must be smaller than maximum value.");
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.");
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::mt19937_64& pseudoRandomGenerator =
getGenerator();
150 std::normal_distribution<F> distribution(mean, standardDeviation);
151 return distribution(pseudoRandomGenerator);
175template <std::
floating_po
int F>
176F normalDistribution(F mean, F standardDeviation, F min, F max)
180 throw std::invalid_argument(
"min cannot be larger than max");
183 F
sample = normalDistribution(mean, standardDeviation);
189 else if (sample < min)
213FAKER_CXX_EXPORT std::string
hexadecimal(
unsigned length = 1, HexCasing casing = HexCasing::Lower,
214 HexPrefix prefix = HexPrefix::ZeroX);
229FAKER_CXX_EXPORT std::string
hexadecimal(std::optional<int> min = std::nullopt, std::optional<int> max = std::nullopt);
242FAKER_CXX_EXPORT std::string
octal(
unsigned length = 1);
257FAKER_CXX_EXPORT std::string
binary(
int length = 1);
273FAKER_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.