Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    31
    Rep Power
    0

    Exclamation Trouble ranging random numbers

    I am having trouble ranging values with the Random.nextDouble() method. It doens't work like the nextInt() method so i'm a bit confused. I need values ranging from 1.00 to 1,000,000.00. The rnd in my code is the object i created from class Random(). This doesn't return the result i'm looking for. It keeps giving me some numbers bigger than 1 million. How do I keep the values within the range?

    PHP Code:
    doubles[i] = 1.00+rnd.nextDouble()*(1000000.00-1.00);

  2. #2
    Join Date
    Mar 2009
    Posts
    31
    Rep Power
    0

    Default

    Never mind haha this was working I just thought it wasn't.

Similar Threads

  1. Replies: 8
    Last Post: 04-19-2009, 06:50 PM
  2. Help with random numbers
    By checkmylongboarding in forum New To Java
    Replies: 2
    Last Post: 01-12-2009, 06:47 AM
  3. Random numbers
    By jithan in forum Advanced Java
    Replies: 3
    Last Post: 06-14-2008, 03:04 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
  •