00001
00002
00003 std::string random_nick(void)
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 }