From: Andre Noll Date: Sun, 28 Oct 2007 02:42:48 +0000 (+0100) Subject: kill dulpicate instance of para_random(). X-Git-Tag: v0.3.0~177 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=8897da301fdbbc7e9b7cff90c2c33dfa9240f66f;p=paraslash.git kill dulpicate instance of para_random(). --- diff --git a/command.c b/command.c index dae21e6d..e294e87c 100644 --- a/command.c +++ b/command.c @@ -599,17 +599,12 @@ static struct server_command *parse_cmd(const char *cmdstr) return get_cmd_ptr(buf, NULL); } -static long int para_rand(long unsigned max) -{ - return (long int) ((max + 0.0) * (random() / (RAND_MAX + 1.0))); -} - static void init_rc4_keys(void) { int i; for (i = 0; i < 2 * RC4_KEY_LEN; i++) - rc4_buf[i] = para_rand(256); + rc4_buf[i] = para_random(256); PARA_DEBUG_LOG("rc4 keys initialized (%u:%u)\n", (unsigned char) rc4_buf[0], (unsigned char) rc4_buf[RC4_KEY_LEN]); diff --git a/para.h b/para.h index 9f2c59a8..2d8d9cce 100644 --- a/para.h +++ b/para.h @@ -218,9 +218,9 @@ __printf_2_3 void para_log(int, const char*, ...); * * \return An integer between zero and \p max - 1, inclusively. */ -static inline int para_random(unsigned max) +static inline long int para_random(unsigned max) { - return ((max + 0.0) * (rand() / (RAND_MAX + 1.0))); + return ((max + 0.0) * (random() / (RAND_MAX + 1.0))); } /** Round up x to a multiple of y */