31template <std::
integral I>
32 requires(
sizeof(I) <=
sizeof(
long long))
37 using LongLongType = std::conditional_t<std::is_unsigned_v<I>,
unsigned long long,
long long>;
41 throw std::invalid_argument(
"Minimum value must be smaller than maximum value.");
46 std::uniform_int_distribution<LongLongType> distribution(min, max);
48 return static_cast<I
>(distribution(pseudoRandomGenerator));
67template <std::
integral I>
68 requires(
sizeof(I) <=
sizeof(
long long))
90template <std::
floating_po
int F>
91F decimal(F min, F max)
95 throw std::invalid_argument(
"Minimum value must be smaller than maximum value.");
99 std::uniform_real_distribution<F> distribution(min, max);
101 return distribution(pseudoRandomGenerator);
120template <std::
floating_po
int F>
123 return decimal<F>(
static_cast<F
>(0.), max);
143template <std::
floating_po
int F>
144F normalDistribution(F mean, F standardDeviation)
146 if (standardDeviation < 0 || standardDeviation == INFINITY || mean == INFINITY)
148 throw std::invalid_argument(
"Standard Deviation cannot be negative");
150 else if (standardDeviation == 0)
155 std::mt19937_64& pseudoRandomGenerator =
getGenerator();
157 std::normal_distribution<F> distribution(mean, standardDeviation);
158 return distribution(pseudoRandomGenerator);
182template <std::
floating_po
int F>
183F normalDistribution(F mean, F standardDeviation, F min, F max)
187 throw std::invalid_argument(
"min cannot be larger than max");
190 F
sample = normalDistribution(mean, standardDeviation);
196 else if (sample < min)
220FAKER_CXX_EXPORT std::string
hexadecimal(
unsigned length = 1, HexCasing casing = HexCasing::Lower,
221 HexPrefix prefix = HexPrefix::ZeroX);
236FAKER_CXX_EXPORT std::string
hexadecimal(std::optional<int> min = std::nullopt, std::optional<int> max = std::nullopt);
249FAKER_CXX_EXPORT std::string
octal(
unsigned length = 1);
264FAKER_CXX_EXPORT std::string
binary(
int length = 1);
280FAKER_CXX_EXPORT std::string
binary(
int min,
int max);
303FAKER_CXX_EXPORT std::string
roman(std::optional<int> min = std::nullopt, std::optional<int> max = std::nullopt);
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.
FAKER_CXX_EXPORT std::string roman(std::optional< int > min=std::nullopt, std::optional< int > max=std::nullopt)
Returns a roman numeral in String format.