StrictMath.random() in Java

StrictMath.random(): This method is available in java.lang.StrictMath class of Java.

Syntax:

double java.lang.StrictMath.random()

This method returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0

Parameters: NA

Returns: a pseudo-random double greater than or equal to 0.0 and less than 1.0.

Exceptions: NA

Approach

Java

public class StrictMathrandom {
    public static void main(String[] args) {

        System.out.println(StrictMath.random());
    }
}

Output:

0.8452903831260384


No comments:

Post a Comment