Use srandomdev

This commit is contained in:
Andrey A. Chernov 1997-09-24 04:48:24 +00:00
parent 1a0eac8a9b
commit 659ca5500f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29768
5 changed files with 8 additions and 6 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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))

View File

@ -51,7 +51,7 @@ main(argc, argv)
register char *p;
int i;
(void) srand(getpid());
srandomdev();
issetuid = getuid() != geteuid();
if (p = rindex(*argv, '/'))
p++;

View File

@ -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)