10#include "faker-cxx/export.h"
24 unsigned int atLeastCount{(std::numeric_limits<unsigned>::min)()};
25 unsigned int atMostCount{(std::numeric_limits<unsigned>::max)()};
76template <
typename T = std::mt19937>
79 static std::uniform_int_distribution<> dist(0, 15);
80 static std::uniform_int_distribution<> dist2(8, 11);
81 static std::string_view hexCharacters{
"0123456789abcdef"};
86 for (
int i = 0; i < 8; i++)
88 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
90 result.append(1,
'-');
92 for (
int i = 0; i < 4; i++)
94 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
96 result.append(1,
'-');
98 result.append(1,
'4');
99 for (
int i = 0; i < 3; i++)
101 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
103 result.append(1,
'-');
105 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist2))]);
107 for (
int i = 0; i < 3; i++)
109 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
111 result.append(1,
'-');
113 for (
int i = 0; i < 12; i++)
115 result.append(1, hexCharacters[
static_cast<size_t>(gen(dist))]);
133FAKER_CXX_EXPORT std::string
sample(
unsigned length = 10);
163FAKER_CXX_EXPORT std::string
symbol(
unsigned minLength = 1,
unsigned maxLength = 10);
178FAKER_CXX_EXPORT std::string
fromCharacters(
const std::string& characters,
unsigned length = 1);
195 unsigned length = 1);
213 const std::string& excludeCharacters =
"");
250 const std::string& excludeCharacters =
"");
284FAKER_CXX_EXPORT std::string
numeric(
unsigned length = 1,
bool allowLeadingZeros =
true);
301FAKER_CXX_EXPORT std::string
numeric(
GuaranteeMap&& guarantee,
unsigned length = 1,
bool allowLeadingZeros =
true);
318FAKER_CXX_EXPORT std::string
nanoId(
int length);
352FAKER_CXX_EXPORT std::string
nanoId(
int minLength,
int maxLength);
Definition random_generator.h:12
FAKER_CXX_EXPORT std::string nanoId()
Generates a unique, URL-safe string identifier of default length.
FAKER_CXX_EXPORT std::string symbol(unsigned minLength=1, unsigned maxLength=10)
Returns a string containing "~`!@#$%^&*()_-+={[}]|:;\"'<,>.?/".
std::string uuid(RandomGenerator< T > gen=RandomGenerator< std::mt19937 >{})
Generates an Universally Unique Identifier with version 4.
Definition string.h:77
FAKER_CXX_EXPORT std::string sample(unsigned length=10)
Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).
StringCasing
Definition string.h:16
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 bool isValidGuarantee(GuaranteeMap &guarantee, std::set< char > &targetCharacters, unsigned length)
Checks if the given guarantee map is valid for given targetCharacters and length.
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:31