From a0041450da452d421fa15f352d533a000c2e7921 Mon Sep 17 00:00:00 2001 From: lukem Date: Sun, 12 Oct 1997 11:45:01 +0000 Subject: WARNSify (not an insignificant task...) --- rogue/random.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'rogue/random.c') diff --git a/rogue/random.c b/rogue/random.c index 6e2abc60..83f65f5c 100644 --- a/rogue/random.c +++ b/rogue/random.c @@ -1,4 +1,4 @@ -/* $NetBSD: random.c,v 1.3 1995/04/22 10:28:06 cgd Exp $ */ +/* $NetBSD: random.c,v 1.4 1997/10/12 11:45:43 lukem Exp $ */ /* * Copyright (c) 1988, 1993 @@ -36,14 +36,17 @@ * SUCH DAMAGE. */ +#include #ifndef lint #if 0 static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: random.c,v 1.3 1995/04/22 10:28:06 cgd Exp $"; +__RCSID("$NetBSD: random.c,v 1.4 1997/10/12 11:45:43 lukem Exp $"); #endif #endif /* not lint */ +#include "rogue.h" + /* * random.c * @@ -74,11 +77,11 @@ static int rand_deg = 31; static int rand_sep = 3; static long *end_ptr = &rntb[32]; +void srrandom(x) -int x; + int x; { - register int i; - long rrandom(); + int i; state[0] = (long) x; if (rand_type != 0) { @@ -115,10 +118,11 @@ rrandom() return(i); } +int get_rand(x, y) -register int x, y; + int x, y; { - register int r, t; + int r, t; long lr; if (x > y) { @@ -133,14 +137,15 @@ register int x, y; return(r); } +int rand_percent(percentage) -register int percentage; + int percentage; { return(get_rand(1, 100) <= percentage); } +int coin_toss() { - return(((rrandom() & 01) ? 1 : 0)); } -- cgit v1.2.3