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