Java IntStream box to create Stream
import java.security.SecureRandom; public class Main { public static void main(String[] args) { SecureRandom random = new SecureRandom(); System.out.printf("%-6s%s%n", "Face", "Frequency"); random.ints(6_000_000, 1, 7)//from w w w. j a va 2s. co m .limit(10) .boxed() .forEach(System.out::println); } }