random number
nextInt(int n) method is used to get a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence. Random rn = new Random(); int answer = rn.nextInt(10) + 1;
Generally speaking, if you need to generate numbers from min to max (including both), you write random.nextInt(max - min + 1) + min