Random ints() in Java

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

Syntax:

IntStream java.util.Random.ints()

This method returns an effectively unlimited stream of pseudorandom int values.

Parameters: NA

Returns: a stream of pseudorandom int values.

Exceptions: NA

Approach

Java

import java.util.Random;

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

        Random random = new Random();

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

Output:

9223372036854775807


No comments:

Post a Comment