A problem of possibility. if 1 to 10*n are random, them n%10 + 1 is random in 1 to 10.
public static int rand7(){
return (int)(Math.random()*7+1);
}
public static int rand10(){
int c = 0;
while(c < 40){
int a = (rand7()-1)*7;
int b = rand7();
c = a + b;
}
return c%10+1;
}