summaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-09-24 04:48:24 +0000
committerache <ache@FreeBSD.org>1997-09-24 04:48:24 +0000
commit297678a001aafa7f8ae3bc00b18772b660f9c510 (patch)
treecee4aebf5a060021c393ffed583d7fc47fca9d45 /games
parent0f3d4fc289f5017634ed2597317e7e15ae3d9f6d (diff)
downloadFreeBSD-src-297678a001aafa7f8ae3bc00b18772b660f9c510.zip
FreeBSD-src-297678a001aafa7f8ae3bc00b18772b660f9c510.tar.gz
Use srandomdev
Diffstat (limited to 'games')
-rw-r--r--games/arithmetic/arithmetic.c3
-rw-r--r--games/quiz/quiz.c2
-rw-r--r--games/sail/externs.h3
-rw-r--r--games/sail/main.c2
-rw-r--r--games/wump/wump.c4
5 files changed, 8 insertions, 6 deletions
diff --git a/games/arithmetic/arithmetic.c b/games/arithmetic/arithmetic.c
index abebdfd..cfde8e9 100644
--- a/games/arithmetic/arithmetic.c
+++ b/games/arithmetic/arithmetic.c
@@ -77,6 +77,7 @@ static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93";
#include <ctype.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
char keylist[] = "+-x/";
char defaultkeys[] = "+-";
@@ -133,7 +134,7 @@ main(argc, argv)
usage();
/* Seed the random-number generator. */
- srandom((int)time((time_t *)NULL));
+ srandomdev();
(void)signal(SIGINT, intr);
diff --git a/games/quiz/quiz.c b/games/quiz/quiz.c
index 287988c..f820d1f 100644
--- a/games/quiz/quiz.c
+++ b/games/quiz/quiz.c
@@ -223,7 +223,7 @@ quiz()
int next;
char *answer, *s, *t, question[LINE_SZ];
- srandom(time(NULL));
+ srandomdev();
guesses = rights = wrongs = 0;
for (;;) {
if (qsize == 0)
diff --git a/games/sail/externs.h b/games/sail/externs.h
index 541b5a6..3b15876 100644
--- a/games/sail/externs.h
+++ b/games/sail/externs.h
@@ -37,6 +37,7 @@
#include <signal.h>
#include <ctype.h>
#include <setjmp.h>
+#include <stdlib.h>
#include "machdep.h"
/* program mode */
@@ -55,7 +56,7 @@ char nobells; /* -b, don't ring bell before Signal */
/* other initial modes */
char issetuid; /* running setuid */
-#define die() ((rand() >> 3) % 6 + 1)
+#define die() (random() % 6 + 1)
#define sqr(a) ((a) * (a))
#define abs(a) ((a) > 0 ? (a) : -(a))
#define min(a,b) ((a) < (b) ? (a) : (b))
diff --git a/games/sail/main.c b/games/sail/main.c
index 4c59f26..37c4aa6 100644
--- a/games/sail/main.c
+++ b/games/sail/main.c
@@ -51,7 +51,7 @@ main(argc, argv)
register char *p;
int i;
- (void) srand(getpid());
+ srandomdev();
issetuid = getuid() != geteuid();
if (p = rindex(*argv, '/'))
p++;
diff --git a/games/wump/wump.c b/games/wump/wump.c
index dec7dfb..4329e7c 100644
--- a/games/wump/wump.c
+++ b/games/wump/wump.c
@@ -54,6 +54,7 @@ static char sccsid[] = "@(#)wump.c 8.1 (Berkeley) 5/31/93";
#include <sys/types.h>
#include <sys/file.h>
#include <stdio.h>
+#include <stdlib.h>
#include "pathnames.h"
/* some defines to spec out what our wumpus cave should look like */
@@ -482,7 +483,6 @@ cave_init()
{
register int i, j, k, link;
int delta, int_compare();
- time_t time();
/*
* This does most of the interesting work in this program actually!
@@ -493,7 +493,7 @@ cave_init()
* than three links, regardless of the quality of the random number
* generator that we're using.
*/
- srandom((int)time((time_t *)0));
+ srandomdev();
/* initialize the cave first off. */
for (i = 1; i <= room_num; ++i)
OpenPOWER on IntegriCloud