ThreadLocalRandom

ThreadLocalRandom is a random number generator that can be accessed from the current thread only.


int r = ThreadLocalRandom.current().nextInt(20, 40);