130206Sbostic /* 230206Sbostic * Copyright (c) 1982 Regents of the University of California. 3*33178Sbostic * All rights reserved. 4*33178Sbostic * 5*33178Sbostic * Redistribution and use in source and binary forms are permitted 6*33178Sbostic * provided that this notice is preserved and that due credit is given 7*33178Sbostic * to the University of California at Berkeley. The name of the University 8*33178Sbostic * may not be used to endorse or promote products derived from this 9*33178Sbostic * software without specific prior written permission. This software 10*33178Sbostic * is provided ``as is'' without express or implied warranty. 1130206Sbostic */ 1230206Sbostic 1330206Sbostic #ifndef lint 14*33178Sbostic static char sccsid[] = "@(#)roll.c 5.2 (Berkeley) 12/29/87"; 15*33178Sbostic #endif /* not lint */ 1630206Sbostic 17*33178Sbostic 1830206Sbostic # include "mille.h" 1930206Sbostic 2030206Sbostic /* 2130206Sbostic * This routine rolls ndie nside-sided dice. 2230206Sbostic * 2330206Sbostic * @(#)roll.c 1.1 (Berkeley) 4/1/82 2430206Sbostic * 2530206Sbostic */ 2630206Sbostic 2730206Sbostic roll(ndie, nsides) 2830206Sbostic reg int ndie, nsides; { 2930206Sbostic 3030206Sbostic reg int tot; 3130206Sbostic extern unsigned int random(); 3230206Sbostic 3330206Sbostic tot = 0; 3430206Sbostic while (ndie--) 3530206Sbostic tot += random() % nsides + 1; 3630206Sbostic return tot; 3730206Sbostic } 38