Initial submit

This commit is contained in:
Torsten Schulz
2017-07-18 23:51:56 +02:00
parent 071d70ecf6
commit 26ab29859d
13 changed files with 535 additions and 68 deletions

View File

@@ -1,12 +1,33 @@
#include "tools.h"
namespace Yp {
namespace Lib {
#include <random>
#include <string>
Tools::Tools()
{
namespace Yc {
namespace Lib {
}
Tools::Tools() {
} // namespace Lib
}
std::string Tools::generateRandomString(size_t length) {
std::string choices(
"0123456789"
"`~!@#$%^&*()-_=+[{]}|\\:;<,>./?"
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
);
std::random_device random;
std::mt19937 generator(random());
std::uniform_int_distribution<size_t> distribution(0, choices.size());
std::string result(length, '0');
for (size_t i = 0; i < length; ++i) {
result[i] = choices[distribution(generator)];
}
return result;
}
} // namespace Lib
} // namespace Yp