xref: /csrg-svn/games/mille/roll.c (revision 60812)
130206Sbostic /*
2*60812Sbostic  * Copyright (c) 1982, 1993
3*60812Sbostic  *	The Regents of the University of California.  All rights reserved.
433178Sbostic  *
542579Sbostic  * %sccs.include.redist.c%
630206Sbostic  */
730206Sbostic 
830206Sbostic #ifndef lint
9*60812Sbostic static char sccsid[] = "@(#)roll.c	8.1 (Berkeley) 05/31/93";
1033178Sbostic #endif /* not lint */
1130206Sbostic 
1230206Sbostic # include	"mille.h"
1330206Sbostic 
1430206Sbostic /*
1530206Sbostic  *	This routine rolls ndie nside-sided dice.
1630206Sbostic  *
1730206Sbostic  * @(#)roll.c	1.1 (Berkeley) 4/1/82
1830206Sbostic  *
1930206Sbostic  */
2030206Sbostic 
roll(ndie,nsides)2130206Sbostic roll(ndie, nsides)
2230206Sbostic reg int	ndie, nsides; {
2330206Sbostic 
2430206Sbostic 	reg int			tot;
2530206Sbostic 	extern unsigned int	random();
2630206Sbostic 
2730206Sbostic 	tot = 0;
2830206Sbostic 	while (ndie--)
2930206Sbostic 		tot += random() % nsides + 1;
3030206Sbostic 	return tot;
3130206Sbostic }
32