Generate Random integer Numbers in Java
Description
The following code shows how to generate Random integer Numbers.
Example
// w ww . jav a 2 s. c o m
import java.util.Random;
public class Main {
public static void main(String[] args) {
Random diceValues = new Random();
System.out.println(diceValues.nextInt(6));
System.out.println(diceValues.nextInt(6));
}
}
The code above generates the following result.