Advertisement
Garey

random_names

Dec 13th, 2017
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <random>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     string names[] = { "Stefan", "Gosho", "Petur", "Ivan" };
  10.  
  11.     minstd_rand generator(time(0));
  12.  
  13.     uniform_int_distribution<> dist(0, 3);
  14.  
  15.     cout << names[dist(generator)];
  16.  
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement