Java Java 8 Streams Java Concurrency
For concurrent access, using ThreadLocalRandom instead of Math.random() results in less contention and, ultimately, better performance.
This class was introduced in JDK 1.7
int i = ThreadLocalRandom.current() .nextInt(100, 1000);
IntStream ints = ThreadLocalRandom.current() .ints(100, 1000) .limit(1000) .forEach(System.out::println);