From: cohrs Date: Mon, 30 Jun 2003 04:18:29 +0000 (+0000) Subject: random numbers on linux X-Git-Tag: MOVE2GIT~1915 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc40ccd7d252bb9549ea02f385d87fca6b1d6d31;p=nethack random numbers on linux Switch the default Linux build behavior to use random instead of lrand48, since lrand48 exhibits some obviously non-random behavior. random() has been in glibc for a long time. Even if no other changes are made to nethack's random number generator, this will improve the Linux behavior. --- diff --git a/doc/fixes34.2 b/doc/fixes34.2 index 32a6b6442..d126cd472 100644 --- a/doc/fixes34.2 +++ b/doc/fixes34.2 @@ -116,6 +116,7 @@ tiles: bad pixels in Croesus and Yeenoghu tiles FreeBSD: incorrect srandom declaration unix: don't autosave if hangup occurs after game is over linux: add example use of nroff on recent Linux distros +linux: use random() by default instead of lrand48() General New Features diff --git a/include/unixconf.h b/include/unixconf.h index 442f02b20..19ebd7f44 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -297,7 +297,7 @@ #endif /* Use the high quality random number routines. */ -#if defined(BSD) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) || defined(__APPLE__) +#if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) || defined(__APPLE__) #define Rand() random() #else #define Rand() lrand48() diff --git a/src/hacklib.c b/src/hacklib.c index 2cd0734eb..c34e7509b 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -466,7 +466,7 @@ setrandom() #ifdef RANDOM /* srandom() from sys/share/random.c */ srandom((unsigned int) time((time_t *)0)); #else -# if defined(__APPLE__) || defined(BSD) || defined(ULTRIX) || defined(CYGWIN32) /* system srandom() */ +# if defined(__APPLE__) || defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) /* system srandom() */ # ifdef BSD # if defined(SUNOS4) (void)