diff options
author | ache <ache@FreeBSD.org> | 1997-09-24 05:18:42 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-09-24 05:18:42 +0000 |
commit | 7798c2955949b1b4cf0f86ccbe2d097537cc9b4f (patch) | |
tree | 187a085246fb20d3ef84a721359ad8b20fb25174 /games/hack | |
parent | 7e983e509909d3549b9b4cef804cf5f052529d52 (diff) | |
download | FreeBSD-src-7798c2955949b1b4cf0f86ccbe2d097537cc9b4f.zip FreeBSD-src-7798c2955949b1b4cf0f86ccbe2d097537cc9b4f.tar.gz |
Use srandomdev
Diffstat (limited to 'games/hack')
-rw-r--r-- | games/hack/hack.mklev.c | 4 | ||||
-rw-r--r-- | games/hack/hack.unix.c | 10 | ||||
-rw-r--r-- | 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 236f832..3217923 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 <stdlib.h> +#include <unistd.h> + #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 88e743f..88ebdd6 100644 --- a/games/hack/hack.unix.c +++ b/games/hack/hack.unix.c @@ -14,22 +14,16 @@ #include <stdio.h> #include <errno.h> +#include <stdlib.h> #include "hack.h" /* mainly for index() which depends on BSD */ #include <sys/types.h> /* for time_t and stat */ #include <sys/stat.h> -#ifdef BSD -#include <sys/time.h> -#else #include <time.h> -#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 8547cef..022cf69 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 <stdlib.h> + +#define RND(x) (random() % x) rn1(x,y) register x,y; |