Home | History | Annotate | Line # | Download | only in hack
rnd.c revision 1.2
      1 #ifndef lint
      2 static char rcsid[] = "$Id: rnd.c,v 1.2 1993/08/02 17:19:45 mycroft 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 }
     33