feat: add randomizeString
This commit is contained in:
@@ -12,3 +12,13 @@ std::string utils::getExePath()
|
||||
if (pos != std::string::npos) return path.substr(0, pos + 1);
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string utils::randomizeString(size_t length)
|
||||
{
|
||||
const char charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
std::string result;
|
||||
result.resize(length);
|
||||
for (size_t i = 0; i < length; ++i)
|
||||
result[i] = charset[rand() % (sizeof(charset) - 1)];
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user