Initial Commit

This commit is contained in:
Yousef Khadadeh 2025-07-06 20:43:53 +03:00
commit 6088fc29ed
978 changed files with 353647 additions and 0 deletions

View file

@ -0,0 +1,26 @@
#include "Random.hpp"
Random Random::global;
Random& Random::get() {
return global;
}
std::string Random::alphanumeric_str(size_t len) {
std::string toRet;
char allowedChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
size_t allowedCharCount = sizeof(allowedChars) / sizeof(char);
// We use allowedCharCount - 2 as the right bound because the range is inclusive,
// and we dont want to include the implicit null terminator in the end of allowedChars
// as a possible character
for(size_t i = 0; i < len; i++)
toRet.push_back(allowedChars[Random::get().int_range<size_t>(0, allowedCharCount - 2)]);
return toRet;
}
Random::Random():
randGen(std::random_device()())
{
}