29template <std::
integral I>
34 throw std::invalid_argument(
"Minimum value must be smaller than maximum value.");
37 static std::mt19937 pseudoRandomGenerator{std::random_device{}()};
39 std::uniform_int_distribution<I> distribution(min, max);
41 return distribution(pseudoRandomGenerator);
60template <std::
integral I>
82template <std::
floating_po
int F>
83F decimal(F min, F max)
87 throw std::invalid_argument(
"Minimum value must be smaller than maximum value.");
90 static std::mt19937 pseudoRandomGenerator{std::random_device{}()};
91 std::uniform_real_distribution<F> distribution(min, max);
93 return distribution(pseudoRandomGenerator);
112template <std::
floating_po
int F>
115 return decimal<F>(
static_cast<F
>(0.), max);
135template <std::
floating_po
int F>
136F normalDistribution(F mean, F standardDeviation)
138 if (standardDeviation < 0 || standardDeviation == INFINITY || mean == INFINITY)
140 throw std::invalid_argument(
"Standard Deviation cannot be negative");
142 else if (standardDeviation == 0)
147 std::random_device randDev;
148 std::mt19937 PSRNG(randDev());
150 std::normal_distribution<F> dist(mean, standardDeviation);
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.