#include <vector>
#include <chrono>
#include <random>
#include <iostream>
auto main()->int {
std::vector<std::string> names; // storage for the names
names.reserve(5); // always reserve ahead, for top performance
names.emplace_back("John"); // emplace instead of push to avoid copies
names.emplace_back("Jeff");
names.emplace_back("Emma");
names.emplace_back("Steve");
names.emplace_back("Julie");
std::mt19937_64 engine; // make sure we use a high quality RNG engine
auto seed((engine, std::chrono::system_clock::now().time_since_epoch().count())); // RNG seed
std::uniform_int_distribution<unsigned> dist(0, names.size() - 1); // distribute linearly
auto number(dist(engine)); // pick a number corresponding to a name
std::string name(names.at(number)); // look up the name by number
std::cout << "Seed: " << seed << ", name: " << name << std::endl; // output the name & seed
return EXIT_SUCCESS; // don't forget to exit politely
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGNocm9ubz4KI2luY2x1ZGUgPHJhbmRvbT4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKYXV0byBtYWluKCktPmludCB7CiAgc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IG5hbWVzOwkJCS8vIHN0b3JhZ2UgZm9yIHRoZSBuYW1lcwogIG5hbWVzLnJlc2VydmUoNSk7CQkJCQkJCS8vIGFsd2F5cyByZXNlcnZlIGFoZWFkLCBmb3IgdG9wIHBlcmZvcm1hbmNlCiAgbmFtZXMuZW1wbGFjZV9iYWNrKCJKb2huIik7CQkJCS8vIGVtcGxhY2UgaW5zdGVhZCBvZiBwdXNoIHRvIGF2b2lkIGNvcGllcwogIG5hbWVzLmVtcGxhY2VfYmFjaygiSmVmZiIpOwogIG5hbWVzLmVtcGxhY2VfYmFjaygiRW1tYSIpOwogIG5hbWVzLmVtcGxhY2VfYmFjaygiU3RldmUiKTsKICBuYW1lcy5lbXBsYWNlX2JhY2soIkp1bGllIik7CgogIHN0ZDo6bXQxOTkzN182NCBlbmdpbmU7CSAgICAgICAgICAgIAkvLyBtYWtlIHN1cmUgd2UgdXNlIGEgaGlnaCBxdWFsaXR5IFJORyBlbmdpbmUKICBh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