Random random = new Random(); int max = 10; int min = 1; int result = random.nextInt(max + 1 - min) + min;