#include <iostream>
std::string rand_string(size_t size) {
const char charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
std::string s;
s.reserve(size);
for (int i = 0; i < size; ++i)
s += charset[rand() % (sizeof(charset) - 1)];
return s;
}
int main(void) {
std::string s;
srand(time(NULL));
for (int i = 0; i < 10; i++) {
s = rand_string(5);
std::cout << s << "\n";
}
return 0;
}
/*
run:
pgNKX
NNEam
SyybQ
WRYjH
bLlOV
OrhLR
Pdycn
xScBU
PwSpX
LLoLX
*/