Echo89

C++ random code generator v2

Nov 20th, 2012
60
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string random(int len)
  2. {
  3.     string a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  4.     string r;
  5.     srand(time(NULL));
  6.     for(int i = 0; i < len; i++) r.push_back(a.at(size_t(rand() % 62)));
  7.     return r;
  8. }
RAW Paste Data