]> granicus.if.org Git - nethack/commitdiff
define Rand() in isaac4 config
authornhmall <nhmall@nethack.org>
Tue, 15 Jan 2019 01:36:50 +0000 (20:36 -0500)
committerPatric Mueller <bhaak@gmx.net>
Mon, 28 Jan 2019 09:02:09 +0000 (10:02 +0100)
Rand() was typically defined to random() or to rand().

gcc seems to provide a random() to link to on linux
when sys/share/random.c is linked in, but other platforms
such as Windows got an undefined refence to random()
when RANDOM wasn't defined.

The only direct use seems to be in get_rnd_txt() these
days, in rumors.c

Under the USE_ISAAC64 config, neither srandom()
nor srand() are being invoked to seed those routines,
and it really should be using isaac64 when USE_ISAAC64
is defined anyway.

include/ntconf.h
include/os2conf.h
include/pcconf.h
include/unixconf.h
include/vmsconf.h
include/wceconf.h

index b681680d26e44f2f74fa7b3cf51eab224116bccb..f7e8ca9cd559d099ef2f6e424ae0725512f8bdbc 100644 (file)
@@ -7,9 +7,6 @@
 
 /* #define SHELL */    /* nt use of pcsys routines caused a hang */
 
-/* #define RANDOM  */  /* have Berkeley random(3) */
-#define USE_ISAAC64
-
 #define TEXTCOLOR /* Color text */
 
 #define EXEPATH              /* Allow .exe location to be used as HACKDIR */
@@ -37,8 +34,9 @@
 
 /*#define CHANGE_COLOR*/ /* allow palette changes */
 #define SELECTSAVED /* Provide menu of saved games to choose from at start */
-
 #define SYS_RANDOM_SEED  /* Use random seed derived from CNG */
+
 /*
  * -----------------------------------------------------------------
  *  The remaining code shouldn't need modification.
@@ -182,12 +180,18 @@ extern void FDECL(interject, (int));
 #include <time.h>
 
 #define USE_STDARG
-#ifdef RANDOM
+
 /* Use the high quality random number routines. */
+#ifdef USE_ISAAC64
+#define Rand() rn2(RAND_MAX)
+#else
+#define RANDOM
+#ifdef RANDOM
 #define Rand() random()
 #else
 #define Rand() rand()
 #endif
+#endif
 
 #include <sys/stat.h>
 #define FCMASK (_S_IREAD | _S_IWRITE) /* file creation mask */
index f033ef584bac86b1b398af638f59400d03b1ef71..cde929982ff65eeb161aa30a39d6828b6ff65596 100644 (file)
 #include <time.h>
 
 /* the high quality random number routines */
-
+#ifdef USE_ISAAC64
+#define Rand() rn2(RAND_MAX)
+#else
 #ifdef RANDOM
 #define Rand() random()
 #else
 #define Rand() rand()
 #endif
+#endif
 
 /* file creation mask */
 
index c5b46bea9157c74b5ba0ea76e87b90b0f710cf3b..9b49288315b0837c1343ea034578eb5fdb327931 100644 (file)
 #include <time.h>
 #endif
 
+/* the high quality random number routines */
+#ifdef USE_ISAAC64
+#define Rand() rn2(RAND_MAX)
+#else
 #ifdef RANDOM
-/* Use the high quality random number routines. */
 #define Rand() random()
 #else
 #define Rand() rand()
 #endif
+#endif
 
 #ifndef TOS
 #define FCMASK 0660 /* file creation mask */
index e4c23cd8d8965d7272189eab5b749ff97623282a..c494d5307c7c3f45db3e8199c11da22766b5550c 100644 (file)
 #endif
 
 /* Use the high quality random number routines. */
+/* the high quality random number routines */
+#ifdef USE_ISAAC64
+#define Rand() rn2(RAND_MAX)
+#else
 #if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \
     || defined(RANDOM) || defined(__APPLE__)
 #define Rand() random()
 #else
 #define Rand() lrand48()
 #endif
+#endif
 
 #ifdef TIMED_DELAY
 #if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX))
index dfee1cb42e2bc86fc3919e09402d0c2ec16cdf19..1c6ea27f96761365a868b192a8480bffe9e8cd2d 100644 (file)
@@ -243,6 +243,9 @@ typedef __mode_t mode_t;
 #define rindex strrchr
 
 /* Use the high quality random number routines. */
+#ifdef USE_ISAAC64
+#define Rand() rn2(RAND_MAX)
+#else
 #if defined(RANDOM)
 #define Rand() random()
 /* VMS V7 adds these entry points to DECC$SHR; stick with the nethack-supplied
@@ -255,6 +258,7 @@ typedef __mode_t mode_t;
 #else
 #define Rand() rand()
 #endif
+#endif
 #define SYS_RANDOM_SEED
 
 #ifndef __GNUC__
index 7ab03f672b3b81b78111042d1bf317299b6790a1..bc6492ab976b5e7e2c0b695c8c9de1355ea46cc5 100644 (file)
 #define index strchr
 #define rindex strrchr
 #define USE_STDARG
-#ifdef RANDOM
+
 /* Use the high quality random number routines. */
+#ifdef USE_ISAAC64
+#define Rand() rn2(RAND_MAX)
+#else
+#ifdef RANDOM
 #define Rand() random()
 #else
 #define Rand() rand()
 #endif
+#endif
 
 #define FCMASK 0660 /* file creation mask */
 #define regularize nt_regularize