10#include "faker-cxx/Export.h"
25 unsigned int atLeastCount{(std::numeric_limits<unsigned int>::min)()};
26 unsigned int atMostCount{(std::numeric_limits<unsigned int>::max)()};
81 template <
typename T = std::mt19937>
84 static std::uniform_int_distribution<> dist(0, 15);
85 static std::uniform_int_distribution<> dist2(8, 11);
86 static std::string_view hexCharacters{
"0123456789abcdef"};
91 for (
int i = 0; i < 8; i++)
93 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
95 result.append(1,
'-');
97 for (
int i = 0; i < 4; i++)
99 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
101 result.append(1,
'-');
103 result.append(1,
'4');
104 for (
int i = 0; i < 3; i++)
106 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
108 result.append(1,
'-');
110 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist2))]);
112 for (
int i = 0; i < 3; i++)
114 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
116 result.append(1,
'-');
118 for (
int i = 0; i < 12; i++)
120 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
138 FAKER_CXX_EXPORT std::string
sample(
unsigned length = 10);
168 FAKER_CXX_EXPORT std::string
fromCharacters(
const std::string& characters,
unsigned length = 1);
203 const std::string& excludeCharacters =
"");
239 const std::string& excludeCharacters =
"");
273 FAKER_CXX_EXPORT std::string
numeric(
unsigned length = 1,
bool allowLeadingZeros =
true);
290 FAKER_CXX_EXPORT std::string
numeric(
GuaranteeMap&& guarantee,
unsigned length = 1,
bool allowLeadingZeros =
true);
308 FAKER_CXX_EXPORT std::string
hexadecimal(
unsigned length = 1, HexCasing casing = HexCasing::Lower,
309 HexPrefix prefix = HexPrefix::ZeroX);
324 FAKER_CXX_EXPORT std::string
hexadecimal(std::optional<int> min = std::nullopt, std::optional<int> max = std::nullopt);
344 HexPrefix prefix = HexPrefix::ZeroX);
357 FAKER_CXX_EXPORT std::string
binary(
unsigned length = 1);
384 FAKER_CXX_EXPORT std::string
octal(
unsigned length = 1);
Definition RandomGenerator.h:11
FAKER_CXX_EXPORT bool isValidGuarantee(GuaranteeMap &guarantee, std::set< char > &targetCharacters, unsigned int length)
Checks if the given guarantee map is valid for given targetCharacters and length.
std::string uuid(RandomGenerator< T > gen=RandomGenerator< std::mt19937 >{})
Generates an Universally Unique Identifier with version 4.
Definition String.h:82
FAKER_CXX_EXPORT std::string sample(unsigned length=10)
Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).
FAKER_CXX_EXPORT std::string hexadecimal(unsigned length=1, HexCasing casing=HexCasing::Lower, HexPrefix prefix=HexPrefix::ZeroX)
Generates a hexadecimal string.
StringCasing
Definition String.h:17
FAKER_CXX_EXPORT std::string binary(unsigned length=1)
Generates a binary string.
FAKER_CXX_EXPORT std::string generateAtLeastString(const GuaranteeMap &guarantee)
Generates the least required string for a given guarantee map.
FAKER_CXX_EXPORT std::string numeric(unsigned length=1, bool allowLeadingZeros=true)
Generates a given length string of digits.
FAKER_CXX_EXPORT std::string alphanumeric(unsigned length=1, StringCasing casing=StringCasing::Mixed, const std::string &excludeCharacters="")
Generates a string consisting of alpha characters and digits.
FAKER_CXX_EXPORT std::string alpha(unsigned length=1, StringCasing casing=StringCasing::Mixed, const std::string &excludeCharacters="")
Generates a string consisting of letters in the English alphabet.
FAKER_CXX_EXPORT std::string fromCharacters(const std::string &characters, unsigned length=1)
Generates a string consisting of given characters.
std::map< char, CharCount > GuaranteeMap
Definition String.h:32
FAKER_CXX_EXPORT std::string octal(unsigned length=1)
Generates an octal string.