中国开发网: 论坛: 程序员情感CBD: 贴子 231413
nostalgic: 冒着被人BS到死也要再发一贴
public class BS {

// main method begins execution of Java application
public static void main( String args[] )
{
int value, frequency[] = new int[ 7 ];


for ( int time = 1; time <= 6000; time++ ) {
value = 1 + ( int ) ( Math.random() * 6 );


++frequency[ value ];
}

String output = "value\tFrequency";

// append frequencies to String output
for ( value = 1; value < frequency.length; value++ )
output += "\n" + value + "\t" + frequency[ value ];

System.out.print(output);
}
}

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录