date and time created 86/11/26 13:36:16 by bostic
[unix-history] / usr / src / games / mille / roll.c
CommitLineData
04e592a5
KB
1/*
2 * Copyright (c) 1982 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7#ifndef lint
8static char sccsid[] = "@(#)roll.c 5.1 (Berkeley) %G%";
9#endif not lint
10
11# include "mille.h"
12
13/*
14 * This routine rolls ndie nside-sided dice.
15 *
16 * @(#)roll.c 1.1 (Berkeley) 4/1/82
17 *
18 */
19
20roll(ndie, nsides)
21reg int ndie, nsides; {
22
23 reg int tot;
24 extern unsigned int random();
25
26 tot = 0;
27 while (ndie--)
28 tot += random() % nsides + 1;
29 return tot;
30}