Java IntStream create from random int values

Description

Java IntStream create from random int values


import java.util.Random;
import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    IntStream.generate(new Random()::nextInt)
    .limit(10)//from  w  w  w.  j  a v a 2s  .c  o m
    .forEach(System.out::println);

  }
}



PreviousNext

Related