The java.lang.Math.random() method returns a pseudorandom double type number greater than or equal to 0.0 and less than 1.0. . When this method is first called, it creates a single new pseudorandom-number generator,
exactly as if by the expression new java.util.Random.
public static double random() Return : This method returns a pseudorandom double greater than or equal to 0.0 and less than 1.0.
Example 1 :To show working of java.lang.Math.random() method.
Example 2 :To show working of java.lang.Math.random() method.
6 8 10 10 5 3 6 10 4 2
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.