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

    Default Producing random numbers

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

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    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
    Location
    Voorschoten, the Netherlands
    Posts
    13,368
    Blog Entries
    7
    Rep Power
    20

    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,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. random numbers
    By lynkxs in forum New To Java
    Replies: 3
    Last Post: 03-07-2013, 09:50 AM
  2. Producing Congruent Numbers
    By freddy92 in forum New To Java
    Replies: 2
    Last Post: 07-04-2011, 01:54 PM
  3. Replies: 8
    Last Post: 04-19-2009, 05:50 PM
  4. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 10:44 PM
  5. random numbers
    By carlos123 in forum New To Java
    Replies: 1
    Last Post: 12-22-2007, 02: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
  •