Math.random()

Math.random() double;

generate a 'double' random number

example of Math.random in java

package codereferececomjava;
 
public class CodeRefereceComJava {
 
 
    public static void main(String[] args) {
 
        double randomDigit;
        randomDigit = Math.random();
        System.out.println(randomDigit); // random number as double
        System.out.println(randomDigit*1000+1); //double random number between 1-1000
        System.out.println((int)(randomDigit*1000+1)); //double random number between 1-1000
 
 }
}

output of Math.random()

   0.362427879998085
   363.427879998085
   363