From 7798c2955949b1b4cf0f86ccbe2d097537cc9b4f Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 24 Sep 1997 05:18:42 +0000 Subject: [PATCH] Use srandomdev --- games/hack/hack.mklev.c | 4 +++- games/hack/hack.unix.c | 10 ++-------- games/hack/rnd.c | 4 +++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/games/hack/hack.mklev.c b/games/hack/hack.mklev.c index 236f83268e22..3217923d274e 100644 --- a/games/hack/hack.mklev.c +++ b/games/hack/hack.mklev.c @@ -1,9 +1,11 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.mklev.c - version 1.0.3 */ +#include +#include + #include "hack.h" -extern char *getlogin(), *getenv(); extern struct monst *makemon(); extern struct obj *mkobj_at(); extern struct trap *maketrap(); diff --git a/games/hack/hack.unix.c b/games/hack/hack.unix.c index 88e743f95517..88ebdd606b03 100644 --- a/games/hack/hack.unix.c +++ b/games/hack/hack.unix.c @@ -14,22 +14,16 @@ #include #include +#include #include "hack.h" /* mainly for index() which depends on BSD */ #include /* for time_t and stat */ #include -#ifdef BSD -#include -#else #include -#endif BSD - -extern char *getenv(); -extern time_t time(); setrandom() { - (void) srandom((int) time ((time_t *) 0)); + (void) srandomdev(); } struct tm * diff --git a/games/hack/rnd.c b/games/hack/rnd.c index 8547cef210a2..022cf691014d 100644 --- a/games/hack/rnd.c +++ b/games/hack/rnd.c @@ -1,6 +1,8 @@ /* rnd.c - version 1.0.2 */ -#define RND(x) ((random()>>3) % x) +#include + +#define RND(x) (random() % x) rn1(x,y) register x,y;