feat: add randomizeString

This commit is contained in:
2026-04-11 12:12:54 -03:00
parent 03a1841b8e
commit e8d387e520
2 changed files with 11 additions and 0 deletions
+10
View File
@@ -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;
}
+1
View File
@@ -5,4 +5,5 @@
namespace utils
{
std::string getExePath();
std::string randomizeString(size_t length);
}