diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /games/hack/rnd.c |
initial import of NetBSD tree
Diffstat (limited to 'games/hack/rnd.c')
-rw-r--r-- | games/hack/rnd.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/games/hack/rnd.c b/games/hack/rnd.c new file mode 100644 index 00000000000..6bdd0aba9bc --- /dev/null +++ b/games/hack/rnd.c @@ -0,0 +1,32 @@ +#ifndef lint +static char rcsid[] = "$NetBSD: rnd.c,v 1.3 1995/03/23 08:32:28 cgd Exp $"; +#endif /* not lint */ + +#define RND(x) ((random()>>3) % x) + +rn1(x,y) +register x,y; +{ + return(RND(x)+y); +} + +rn2(x) +register x; +{ + return(RND(x)); +} + +rnd(x) +register x; +{ + return(RND(x)+1); +} + +d(n,x) +register n,x; +{ + register tmp = n; + + while(n--) tmp += RND(x); + return(tmp); +} |