1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-16 06:25:24 +00:00

Removed all srand calls and added a single srand invokation in at startup

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4264 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Jochen Eisinger 2006-03-26 08:42:34 +00:00 committed by c0ffee
parent 47704b800d
commit 4de9baf8f1
6 changed files with 4 additions and 5 deletions

View File

@ -440,7 +440,6 @@ 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;
@ -475,7 +474,6 @@ 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;

View File

@ -55,6 +55,8 @@ void noui_init(void)
{ NULL, '\0', 0, NULL }
};
srand(time(NULL));
autoload_module = NULL;
args_register(options);

View File

@ -336,6 +336,8 @@ int main(int argc, char **argv)
g_mem_set_vtable(&gc_mem_table);
#endif
srand(time(NULL));
dummy = FALSE;
quitting = FALSE;
core_init_paths(argc, argv);

View File

@ -331,7 +331,6 @@ 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';

View File

@ -515,7 +515,6 @@ static void cmd_dcc_chat(const char *data, IRC_SERVER_REC *server)
signal_emit("dcc request send", 1, dcc);
/* generate a random id */
srand(time(NULL));
p_id = rand() % 64;
dcc->pasv_id = p_id;

View File

@ -438,7 +438,6 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname,
/* Generate an ID for this send if using passive protocol */
if (passive) {
srand(time(NULL));
dcc->pasv_id = rand() % 64;
}