Results 1 to 9 of 9
  1. #1
    lemon is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Default problem of random value

    Hi, guys. I have a problem about random value
    someone can help me?

    there are some rate: rate 1 = 0.8, rate 2 = 1.2, rate 3 = 0.9;
    every rate changes by a different random value between 0.5 and 1.8 per five seconds.
    how to write the code?

  2. #2
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Um explain a little more? Are you trying to put this into a graphical interface? I don't know how you would time something without it.

    Have you attempted writing this code out yet? I doubt anyone here will write the code for you.

  3. #3
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    I'm completely lost to what this guy is talking about.

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Dark View Post
    I'm completely lost to what this guy is talking about.
    If the probability of pulling out a red marble equals 2/3 he is right; but I don't understand the context either ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Very unforunate spambot I think.

  6. #6
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default

    No no, I think he just needs help writing a script to generate random numbers, with these requirements:

    A) We have 3 variables with initial double values (0.8, 1.2, 0.9)
    B) Alter the initial values every 5 seconds
    C) The alteration should be +- random number
    D) random number has the range of 0.5 to 1.8

    Why he would want that is anyones guess.

  7. #7
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Well unless he comes to clarify his question I see no reason to try and help past what we have done so far.

  8. #8
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default

    Yeah, that's why I didn't bother either. He went offline anyway.

  9. #9
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    However if he meant to say what you did, the code would be rather simple to put together.

Similar Threads

  1. Java program problem.. Arrays.. Random Numbers
    By Chewart in forum New To Java
    Replies: 16
    Last Post: 11-16-2009, 10:21 PM
  2. Replies: 14
    Last Post: 10-19-2009, 10:57 AM
  3. Replies: 8
    Last Post: 04-19-2009, 05:50 PM
  4. Random problem
    By mcal in forum New To Java
    Replies: 18
    Last Post: 01-24-2008, 04:00 AM
  5. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 10:44 PM

Posting Permissions

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