diff options
Diffstat (limited to 'test/test-time.c')
-rw-r--r-- | test/test-time.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/test-time.c b/test/test-time.c index ca47205d..fd4de7b6 100644 --- a/test/test-time.c +++ b/test/test-time.c @@ -32,7 +32,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#ifndef WIN32 +#ifndef _WIN32 #include <unistd.h> #include <sys/time.h> #endif @@ -41,6 +41,7 @@ #include "event2/event.h" #include "event2/event_compat.h" #include "event2/event_struct.h" +#include "util-internal.h" int called = 0; @@ -48,14 +49,12 @@ int called = 0; struct event *ev[NEVENT]; +struct evutil_weakrand_state weakrand_state; + static int rand_int(int n) { -#ifdef WIN32 - return (int)(rand() % n); -#else - return (int)(random() % n); -#endif + return evutil_weakrand_(&weakrand_state) % n; } static void @@ -84,7 +83,7 @@ main(int argc, char **argv) { struct timeval tv; int i; -#ifdef WIN32 +#ifdef _WIN32 WORD wVersionRequested; WSADATA wsaData; @@ -93,6 +92,8 @@ main(int argc, char **argv) (void) WSAStartup(wVersionRequested, &wsaData); #endif + evutil_weakrand_seed_(&weakrand_state, 0); + /* Initalize the event library */ event_init(); |