import java.util.Random; Random rand = new Random(); int num = rand.nextInt(10); // 0 - 9 num = num +1; // 1 - 10