Java Random create random IntStream
import java.util.Random; public class Main { public static void main(String[] args) { new Random().ints() .limit(10)// ww w .jav a 2 s. c o m .forEach(System.out::println); } }