Throw of a dice in Java
Posted
by Arkapravo
on Stack Overflow
See other posts from Stack Overflow
or by Arkapravo
Published on 2010-04-10T03:47:47Z
Indexed on
2010/04/10
3:53 UTC
Read the original article
Hit count: 336
java
The throw of a dice is a popular program in Java,
public class Dice {
/* This program simulates rolling a dice */
public static void main(String[] args) {
int dice; // The number on the dice.
dice = (int) (Math.random() * 6 + 1);
System.out.println (dice);
}
}
What I wish to do is make it repeat, 500 times. I have not been able to put this program into a loop of 500. I usually program in Python, thus I guess my Java has rusted !
Any help is most welcome !
© Stack Overflow or respective owner