import java.util.Random;  Random rand = new Random(); int random_integer = rand.nextInt(upperbound-lowerbound) + lowerbound;

Read more of this post