The random keyword, as the name suggests, is used to generate random values for computations and operations in Java 8.
The following piece of code is used to print out 20 random numbers using the forEach loop:
Random random = new Random();
random.ints().limit(20).forEach(System.out::println);