repo.or.cz
/
dragonfly.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
kernel - Add KERN_PROC_SIGTRAMP
[dragonfly.git]
/
games
/
hack
/
rnd.c
blob
b761dd958904f3dd8f649e12fcf3e00130a2eec3
1
/* rnd.c - version 1.0.2 */
2
/* $FreeBSD: src/games/hack/rnd.c,v 1.5 1999/11/16 10:26:38 marcel Exp $ */
3
/* $DragonFly: src/games/hack/rnd.c,v 1.3 2006/08/21 19:45:32 pavalos Exp $ */
4
5
#include
"hack.h"
6
7
#define RND(x) (random() % x)
8
9
int
10
rn1
(
int
x
,
int
y
)
11
{
12
return
(
RND
(
x
) +
y
);
13
}
14
15
int
16
rn2
(
int
x
)
17
{
18
return
(
RND
(
x
));
19
}
20
21
int
22
rnd
(
int
x
)
23
{
24
return
(
RND
(
x
) +
1
);
25
}
26
27
int
28
d
(
int
n
,
int
x
)
29
{
30
int
tmp
=
n
;
31
32
while
(
n
--)
33
tmp
+=
RND
(
x
);
34
return
(
tmp
);
35
}