diff options
| author | lukem <lukem@NetBSD.org> | 1997-10-12 11:45:01 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 1997-10-12 11:45:01 +0000 |
| commit | a0041450da452d421fa15f352d533a000c2e7921 (patch) | |
| tree | 500a4c4a314b36a49f50552293c66aa268eb59f2 /rogue/random.c | |
| parent | 8d2dd1244517d9cf4b4e1fd9a4914c5496e8dfac (diff) | |
| download | bsdgames-darwin-a0041450da452d421fa15f352d533a000c2e7921.tar.gz bsdgames-darwin-a0041450da452d421fa15f352d533a000c2e7921.zip | |
WARNSify (not an insignificant task...)
Diffstat (limited to 'rogue/random.c')
| -rw-r--r-- | rogue/random.c | 23 |
1 files changed, 14 insertions, 9 deletions
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 <sys/cdefs.h> #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)); } |
