aboutsummaryrefslogtreecommitdiffhomepage
path: root/fishd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fishd.cpp')
-rw-r--r--fishd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/fishd.cpp b/fishd.cpp
index 1cd7be6f..be69ac41 100644
--- a/fishd.cpp
+++ b/fishd.cpp
@@ -224,8 +224,9 @@ static void sprint_rand_digits( char *str, int maxlen )
Cast to unsigned so that wrapping occurs on overflow as per ANSI C.
*/
(void)gettimeofday( &tv, NULL );
- srand( (unsigned int)tv.tv_sec + (unsigned int)tv.tv_usec * 1000000UL );
- max = 1 + (maxlen - 1) * (rand() / (RAND_MAX + 1.0));
+ unsigned long long seed = tv.tv_sec + tv.tv_usec * 1000000ULL;
+ srand( (unsigned int)seed );
+ max = (int)(1 + (maxlen - 1) * (rand() / (RAND_MAX + 1.0)));
for( i = 0; i < max; i++ )
{
str[i] = '0' + 10 * (rand() / (RAND_MAX + 1.0));