ircproxy The Ultimate Cyborg |
Definition in file random_nick.h.
#include <string>
Go to the source code of this file.
Functions | |
std::string | random_nick (void) |
Return a random nick of 11 characters. |
std::string random_nick | ( | void | ) |
Return a random nick of 11 characters.
Definition at line 3 of file random_nick.cc.
00004 { 00005 static char const ircchars[] = "abcdefghijklmnopqrstuvwxyz0123456789"; 00006 static bool initialized = false; 00007 if (!initialized) 00008 { 00009 struct timeval tv; 00010 gettimeofday(&tv, NULL); 00011 srandom(tv.tv_usec); 00012 initialized = true; 00013 } 00014 std::string nick; 00015 nick = ircchars[random() % 26]; 00016 for (int i = 0; i < 11; ++i) 00017 nick += ircchars[random() % 36]; 00018 return nick; 00019 }
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|