]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/rnd.c
KERNEL -> _KERNEL
[bsdgames-darwin.git] / hack / rnd.c
1 #ifndef lint
2 static char rcsid[] = "$NetBSD: rnd.c,v 1.3 1995/03/23 08:32:28 cgd Exp $";
3 #endif /* not lint */
4
5 #define RND(x) ((random()>>3) % x)
6
7 rn1(x,y)
8 register x,y;
9 {
10 return(RND(x)+y);
11 }
12
13 rn2(x)
14 register x;
15 {
16 return(RND(x));
17 }
18
19 rnd(x)
20 register x;
21 {
22 return(RND(x)+1);
23 }
24
25 d(n,x)
26 register n,x;
27 {
28 register tmp = n;
29
30 while(n--) tmp += RND(x);
31 return(tmp);
32 }