Commit | Line | Data |
---|---|---|
04e592a5 KB |
1 | /* |
2 | * Copyright (c) 1982 Regents of the University of California. | |
82278f7a KB |
3 | * All rights reserved. |
4 | * | |
7c5ab767 | 5 | * %sccs.include.redist.c% |
04e592a5 KB |
6 | */ |
7 | ||
8 | #ifndef lint | |
7c5ab767 | 9 | static char sccsid[] = "@(#)roll.c 5.4 (Berkeley) %G%"; |
82278f7a KB |
10 | #endif /* not lint */ |
11 | ||
04e592a5 KB |
12 | # include "mille.h" |
13 | ||
14 | /* | |
15 | * This routine rolls ndie nside-sided dice. | |
16 | * | |
17 | * @(#)roll.c 1.1 (Berkeley) 4/1/82 | |
18 | * | |
19 | */ | |
20 | ||
21 | roll(ndie, nsides) | |
22 | reg int ndie, nsides; { | |
23 | ||
24 | reg int tot; | |
25 | extern unsigned int random(); | |
26 | ||
27 | tot = 0; | |
28 | while (ndie--) | |
29 | tot += random() % nsides + 1; | |
30 | return tot; | |
31 | } |