Results 1 to 3 of 3
  1. #1
    csanch11 is offline Member
    Join Date
    Oct 2013
    Rep Power

    Default Producing random numbers

    does nums.nextInt(10); generate random numbers between 0 and 10?

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Producing random numbers

    Write a small test program with that line of code inside a loop and have a println() statement print out the results.
    Look at what is printed.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Producing random numbers

    Straight from the java docs:

    nextInt(int n)
    Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.
    You could've looked it up yourself ...

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. random numbers
    By lynkxs in forum New To Java
    Replies: 3
    Last Post: 03-07-2013, 10:50 AM
  2. Producing Congruent Numbers
    By freddy92 in forum New To Java
    Replies: 2
    Last Post: 07-04-2011, 02:54 PM
  3. Replies: 8
    Last Post: 04-19-2009, 06:50 PM
  4. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 11:44 PM
  5. random numbers
    By carlos123 in forum New To Java
    Replies: 1
    Last Post: 12-22-2007, 03:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts