Originally Posted by
Norm
No, they often don't. The computer does what you tell it to, not what you expect it to.
Can you explain what the program does that you don't expect and what you want it to do.
Haha you said it.
OK the nextInt needs to be given a range I don't know what range it is in your case it could be 1-9, 1-15, 0-15 I don't believe you said. I'm guessing from your code (x=x%9+1) it's 1-9 so lets assume that for this post.
you would need 9 numbers I don't think you can set a range(I may be wrong here) so you just add the minimum number you'd expect so in this case 1 so you would say
int x=r.nextInt(9);
x+=1;
or
That should give you just numbers in the range 1-9 you can adapt this obviously.
But I'm not really sure what you want it to do are you checking if the lines add up to 15 or are you trying to ensure they add up 15?