Habs gefunden, wenn es jemanden interessiert, hier:
#include
#include
#include
#include
#include
//...
const std::size_t count = 2;
std::vector< std::string > initialize()
{
std::srand(time(NULL));
std::vector< std::string > v(count);
v[0] = "хакер";
v[1] = "нуб";
return v;
}
const std::string &generator()
{
static std::vector< std::string > v = initialize();
std::size_t index = rand() % count;
return v[index];
}
// ...
std::cout << "Вася " << generator() << std::endl;