One more time:
You have a function whose argument is an int named max.
You want the function to return a number in the range 1, 2, ..., max.
My statements used N instead of max.
Write a...
Type: Posts; User: Zaphod_b
One more time:
You have a function whose argument is an int named max.
You want the function to return a number in the range 1, 2, ..., max.
My statements used N instead of max.
Write a...
What I meant was the following:
To get a number in the range 1, 2, ..., N, here's what you do:
Call nextInt() with an argument that gives a value in the range 0, 1, 2, ..., N-1.
...
I don't it will either. In fact I know it won't.
Consider:
If you call nextInt(10), you get numbers 0, 1, ..., 9, so nextInt(10)+1 gives a number in the range 1, 2, ..., 10. Right?
If you...