dice in java code example
Example: dice in java
/*
Author: Jeffrey Huang
[email protected]
This is a simple code that uses math.random
to generate a number from 1-6, inclusive.
*/
import java.util.Random;
public class Main
{
public static void main(String[] args) {
int i;
i = (int)(6*Math.random()+1);
System.out.println(i);
}
}