求助java 模拟骰子源文件!!

来源:百度知道 编辑:UC知道 时间:2024/05/16 13:52:25
求助java 模拟骰子源文件!!有那位高人会,帮帮忙,不胜感激。

不难啊
利用Math.random这个函数
我不会做图形
只能给你控制台的代码
class ShaiZi
{
static int a,b;
public static voind main(String argsp[])
{
a = (int)(Math.random()*6+1);
System.out.println(a);
}
}