how to find random number between 1-50 java code example Example: java random number generator in range int rand = ThreadLocalRandom.current().nextInt(x,y);