Unique Random Numbers
Thanking Java's stream feature, it is easy to generate a list of unique random numbers. For example, we want to pick up 6 lucky numbers for Lotto which ranges from 1 to 59. new Random().ints(1, 59+1).distinct().limit(6).sorted().boxed().collect(Collectors.toList());