Update Timer class to accept functions with any number of parameters
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include <algorithm>
|
||||
#include "Util.h"
|
||||
|
||||
|
||||
namespace PresenceDetection {
|
||||
namespace Util {
|
||||
|
||||
std::string CreateRandomString(size_t length)
|
||||
{
|
||||
auto randchar = []() -> char
|
||||
{
|
||||
const char charset[] =
|
||||
"0123456789"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz";
|
||||
const size_t max_index = (sizeof(charset) - 1);
|
||||
return charset[ rand() % max_index ];
|
||||
};
|
||||
std::string str(length,0);
|
||||
std::generate_n(str.begin(), length, randchar);
|
||||
return str;
|
||||
}
|
||||
|
||||
} // namespace Util
|
||||
} // namespace PresenceDetection
|
||||
Reference in New Issue
Block a user