]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
kill dulpicate instance of para_random().
authorAndre Noll <maan@systemlinux.org>
Sun, 28 Oct 2007 02:42:48 +0000 (03:42 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 28 Oct 2007 02:42:48 +0000 (03:42 +0100)
command.c
para.h

index dae21e6d037dda6d920bd4b0ed7e9094cef777f4..e294e87c9cbbe6e9ce1e2358ceb9b10e30035a09 100644 (file)
--- 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);
 }
 
        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++)
 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]);
        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 9f2c59a885aa2ee028de2056e23641575f9c8ad6..2d8d9cce390d5cb66fa7b3bea040210ff9426bb5 100644 (file)
--- 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.
  */
  *
  * \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 */
 }
 
 /** Round up x to a multiple of y */