Random doubles() in Java

doubles(): This method is available in java.util.Random class of Java.

Syntax:

DoubleStream java.util.Random.doubles()

This method returns an effectively unlimited stream of pseudo random double values, each between zero (inclusive) and one(exclusive).

Parameters: NA

Returns: a stream of pseudo random double values.

Exceptions: NA

Approach

Java

import java.util.Random;

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

        Random random = new Random();

        System.out.println(random.doubles().count());
    }
}

Output:

9223372036854775807


No comments:

Post a Comment