random class example with range Example: java random number generator in range int rand = ThreadLocalRandom.current().nextInt(x,y);