本文共 577 字,大约阅读时间需要 1 分钟。
一 代码
package Rolls;import Counter.Counter;import common.StdOut;import common.StdRandom;/*** Copyright (C), 2020-2020, XXX有限公司* FileName: Rolls* Author: cakin* Date: 2020/1/11* Description: 模拟投掷骰子*/public class Rolls { public static void main( String[] args ) { int T = Integer.parseInt(args[0]); int SIDES = 6; Counter[] rolls = new Counter[SIDES+1]; for(int i=1;i<=SIDES;i++){ rolls[i] = new Counter(i+"'s"); } for(int t=0;t
二 测试结果
当投掷1000000次的结果
166995 1's166249 2's166429 3's167018 4's166639 5's166670 6's
三 代码参考
转载地址:http://efqj.baihongyu.com/