Answers for "java dice roll"

1

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);
	}
}
Posted by: Guest on February-20-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language