]> granicus.if.org Git - nethack/commitdiff
random numbers on linux
authorcohrs <cohrs>
Mon, 30 Jun 2003 04:18:29 +0000 (04:18 +0000)
committercohrs <cohrs>
Mon, 30 Jun 2003 04:18:29 +0000 (04:18 +0000)
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.

doc/fixes34.2
include/unixconf.h
src/hacklib.c

index 32a6b64424f380731e58858250526f0d4c6422cf..d126cd472231d494ec058de70f358f9893693228 100644 (file)
@@ -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
index 442f02b2031f1abb1e6833bf7245254dc396546b..19ebd7f44cd68dfd2a374e5e4179231aac9bbb01 100644 (file)
 #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()
index 2cd0734eb67447697d1e80a27bc6fbca9041d81d..c34e7509bcc188d0e1a5d8faf33bb5ee230e2ee7 100644 (file)
@@ -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)