diff options
author | Jochen Eisinger <c0ffee@irssi.org> | 2006-03-25 21:59:57 +0000 |
---|---|---|
committer | c0ffee <c0ffee@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2006-03-25 21:59:57 +0000 |
commit | 47704b800d63248a339637d2625d628aa32f3191 (patch) | |
tree | 5dc8428b16b9bc1a4cd732446329549907b46e4a | |
parent | 71db22a171e87cf5a1e11e8ad9a08c4b64631f8c (diff) | |
download | irssi-47704b800d63248a339637d2625d628aa32f3191.zip |
prefixed all calls to rand() with a call to srand(time(NULL)), so we get
halfway random behaviour.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4263 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/core/network.c | 2 | ||||
-rw-r--r-- | src/irc/bot/bot-users.c | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/core/network.c b/src/core/network.c index 21235b2a..8be0bd51 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -440,6 +440,7 @@ int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6) return HOST_NOT_FOUND; /* shouldn't happen? */ /* if there are multiple addresses, return random one */ + srand(time(NULL)); use_v4 = count_v4 <= 1 ? 0 : rand() % count_v4; use_v6 = count_v6 <= 1 ? 0 : rand() % count_v6; @@ -474,6 +475,7 @@ int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6) /* if there are multiple addresses, return random one */ ip4->family = AF_INET; + srand(time(NULL)); memcpy(&ip4->ip, hp->h_addr_list[rand() % count], 4); return 0; diff --git a/src/irc/bot/bot-users.c b/src/irc/bot/bot-users.c index f9f6eae7..6c7a16e0 100644 --- a/src/irc/bot/bot-users.c +++ b/src/irc/bot/bot-users.c @@ -331,6 +331,7 @@ void botuser_set_password(USER_REC *user, const char *password) g_return_if_fail(user != NULL); g_return_if_fail(password != NULL); + srand(time(NULL)); salt[0] = rand()%20 + 'A'; salt[1] = rand()%20 + 'A'; salt[2] = '\0'; |