diff options
author | dholland <dholland@NetBSD.org> | 2014-03-29 19:33:03 +0000 |
---|---|---|
committer | dholland <dholland@NetBSD.org> | 2014-03-29 19:33:03 +0000 |
commit | fa3a22500af8a864dcb4e24df60437f2c8503df7 (patch) | |
tree | 97e1fe7127f950ffca01c9edd6f6ef444567d257 /hunt | |
parent | 852d65ef1cb8ca457c97c224bf61a57cfed23c59 (diff) | |
download | bsdgames-darwin-fa3a22500af8a864dcb4e24df60437f2c8503df7.tar.gz bsdgames-darwin-fa3a22500af8a864dcb4e24df60437f2c8503df7.tar.zst bsdgames-darwin-fa3a22500af8a864dcb4e24df60437f2c8503df7.zip |
use random(), not a handrolled 16-bit generator
Diffstat (limited to 'hunt')
-rw-r--r-- | hunt/huntd/driver.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/hunt/huntd/driver.c b/hunt/huntd/driver.c index ff5411d9..ea91fe77 100644 --- a/hunt/huntd/driver.c +++ b/hunt/huntd/driver.c @@ -1,4 +1,4 @@ -/* $NetBSD: driver.c,v 1.22 2013/10/19 17:23:08 christos Exp $ */ +/* $NetBSD: driver.c,v 1.23 2014/03/29 19:33:03 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: driver.c,v 1.22 2013/10/19 17:23:08 christos Exp $"); +__RCSID("$NetBSD: driver.c,v 1.23 2014/03/29 19:33:03 dholland Exp $"); #endif /* not lint */ #include <sys/ioctl.h> @@ -45,14 +45,6 @@ __RCSID("$NetBSD: driver.c,v 1.22 2013/10/19 17:23:08 christos Exp $"); #include <unistd.h> #include"hunt.h" -#ifndef pdp11 -#define RN (((Seed = Seed * 11109 + 13849) >> 16) & 0xffff) -#else -#define RN ((Seed = Seed * 11109 + 13849) & 0x7fff) -#endif - -static int Seed = 0; - static SOCKET Daemon; static char *First_arg; /* pointer to argv[0] */ @@ -411,7 +403,7 @@ init(void) fdset[2].fd = -1; #endif - Seed = getpid() + time(NULL); + srandom(time(NULL)); makemaze(); #ifdef BOOTS makeboots(); @@ -810,7 +802,7 @@ zap(PLAYER *pp, FLAG was_player, int i) int rand_num(int range) { - return (range == 0 ? 0 : RN % range); + return (range == 0 ? 0 : random() % range); } /* |