Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. void gen_random(char *s, const int len) {
  2. static const char alphanum[] =
  3. "0123456789"
  4. "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  5. "abcdefghijklmnopqrstuvwxyz";
  6.  
  7. for (int i = 0; i < len; ++i) {
  8. s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
  9. }
  10.  
  11. s[len] = 0;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement