java random numbers in specific range

Java
import java.util.Random;

Random rand = new Random();
int random_integer = rand.nextInt(upperbound-lowerbound) + lowerbound;int rand = ThreadLocalRandom.current().nextInt(x,y);
Source

Also in Java: