roll.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 30 行

C
30
字号
/* ------------------------------------------------------------------ *//* | Copyright Unpublished, MIPS Computer Systems, Inc.  All Rights | *//* | Reserved.  This software contains proprietary and confidential | *//* | information of MIPS and its suppliers.  Use, disclosure or     | *//* | reproduction is prohibited without the prior express written   | *//* | consent of MIPS.                                               | *//* ------------------------------------------------------------------ *//* $Header: roll.c,v 1.2 86/07/24 15:23:31 dce Exp $ */# include	"mille.h"/* *	This routine rolls ndie nside-sided dice. * * @(#)roll.c	1.1 (Berkeley) 4/1/82 * */roll(ndie, nsides)reg int	ndie, nsides; {	reg int			tot;	extern unsigned int	random();	tot = 0;	while (ndie--)		tot += random() % nsides + 1;	return tot;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?