blob: a9e16d24574c5c5cb8d870fb1172a100336ff6e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/* $OpenBSD: rnd.c,v 1.2 2001/01/28 23:41:46 niklas Exp $ */
#ifndef lint
static char rcsid[] = "$OpenBSD: rnd.c,v 1.2 2001/01/28 23:41:46 niklas 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);
}
|