Search:

Type: Posts; User: Zaphod_b

Search: Search took 0.07 seconds.

  1. Re: Creating a Secret Numbers game, need help with random number max and min.

    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...
  2. Re: Creating a Secret Numbers game, need help with random number max and min.

    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.


    ...
  3. Re: Creating a Secret Numbers game, need help with random number max and min.

    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...
Results 1 to 3 of 3