Random.nextInt(n) returns a distributed int value between 0 (inclusive) and n (exclusive).
// random number between 0 AND 10
import java.util.Random;
publicclass Main {
publicstaticvoid main(String[] argv) {
Random r = new Random();
int randint = r.nextInt(10);
System.out.println(randint);
}
}