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 8 static char sccsid[] = "@(#)roll.c 5.1 (Berkeley) 11/26/86"; 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 20 roll(ndie, nsides) 21 reg 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 } 31