how to choose random number java code example
Example 1: generate random number java
// JAVA - WITH A RANGE
(Math.random() * ((max - min) + 1)) + min
Example 2: Random number generator in java
// example on Math.random() method in java
public class RandomMethodExample
{
public static void main(String[] args)
{
// here we are generating random doubles
System.out.println(Math.random());
System.out.println(Math.random());
}
}