xref: /original-bsd/games/mille/roll.c (revision 89363ea9)
1 /*
2  * Copyright (c) 1982 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)roll.c	5.4 (Berkeley) 06/01/90";
10 #endif /* not lint */
11 
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 }
32