Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string random(size_t len)
- {
- static const string a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- static mt19937 x(time(NULL));
- static uniform_int_distribution<size_t> d(0, a.size() - 1);
- string r;
- srand(time(NULL));
- for(size_t i = 0; i < len; i++) r += a.at[d(x)];
- return r;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement