summaryrefslogtreecommitdiffstats
path: root/hack/rnd.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1997-10-19 16:56:41 +0000
committerchristos <christos@NetBSD.org>1997-10-19 16:56:41 +0000
commit84e7d0704483ce39bbdeacd5e676168db6fa664f (patch)
treef9ffeffa1a4342e749494bc3f5618552435839af /hack/rnd.c
parentf73f1009084e75624e3bc00fef9cf4749de80dcc (diff)
downloadbsdgames-darwin-84e7d0704483ce39bbdeacd5e676168db6fa664f.tar.gz
bsdgames-darwin-84e7d0704483ce39bbdeacd5e676168db6fa664f.tar.zst
bsdgames-darwin-84e7d0704483ce39bbdeacd5e676168db6fa664f.zip
WARNsify...
Diffstat (limited to 'hack/rnd.c')
-rw-r--r--hack/rnd.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/hack/rnd.c b/hack/rnd.c
index 6bdd0aba..33e96c22 100644
--- a/hack/rnd.c
+++ b/hack/rnd.c
@@ -1,32 +1,44 @@
+/* $NetBSD: rnd.c,v 1.4 1997/10/19 16:59:39 christos Exp $ */
+
+#include <sys/cdefs.h>
#ifndef lint
-static char rcsid[] = "$NetBSD: rnd.c,v 1.3 1995/03/23 08:32:28 cgd Exp $";
-#endif /* not lint */
+__RCSID("$NetBSD: rnd.c,v 1.4 1997/10/19 16:59:39 christos Exp $");
+#endif /* not lint */
+
+#include <stdlib.h>
+#include "hack.h"
+#include "extern.h"
#define RND(x) ((random()>>3) % x)
-rn1(x,y)
-register x,y;
+int
+rn1(x, y)
+ int x, y;
{
- return(RND(x)+y);
+ return (RND(x) + y);
}
+int
rn2(x)
-register x;
+ int x;
{
- return(RND(x));
+ return (RND(x));
}
+int
rnd(x)
-register x;
+ int x;
{
- return(RND(x)+1);
+ return (RND(x) + 1);
}
-d(n,x)
-register n,x;
+int
+d(n, x)
+ int n, x;
{
- register tmp = n;
+ int tmp = n;
- while(n--) tmp += RND(x);
- return(tmp);
+ while (n--)
+ tmp += RND(x);
+ return (tmp);
}