Results 1 to 14 of 14

Thread: Random

  1. #1
    Arnold is offline Member
    Join Date
    Oct 2009
    Location
    Rotterdam
    Posts
    52
    Rep Power
    0

    Arrow Random

    I recently discovered this random site. It is capable to generate random numbers in a far better fashion than "java.util.Random". It can even do it for free!
    The only problem is that I have no idea how to make a Java application contact this website, give it some numbers as input, and await output from it.
    Any ideas how?

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Google "Java Marsenne Twister" for a Random Number generator (a single class) which you can use exactly as you use random now, but faster and with one of the best random number generator algorithms there is.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    It is capable to generate random numbers in a far better fashion than "java.util.Random".
    How is this documented? And even if so, do you know for a fact that the Random class embedded in Java is currently failing you? Just curious.

  4. #4
    Arnold is offline Member
    Join Date
    Oct 2009
    Location
    Rotterdam
    Posts
    52
    Rep Power
    0

    Question

    Quote Originally Posted by Fubarable View Post
    How is this documented? And even if so, do you know for a fact that the Random class embedded in Java is currently failing you? Just curious.
    I'm actually more curious how to make computer programs contact a website and await output from it. There has to be some way...

  5. #5
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Some manual tests showed it was faster, and studies comparing the Marsenne Twister algorithm against the algorithm that Java uses (it was actually a study of random number generation in general) for the reliability of the algorithm. As well as a few million generated numbers then plotteed to see distribution. Granted, a "few" million is not all that large of a sample size, but large enough to at east see some tendencies. And those from the Marsenne Twister were both more widely disseminated, as well as being less "uniformly" distributed. More "random".

    Edit: I am currently working on my third financial simulation model for the company I work for, so I do have some experience in this area. ;-)
    Last edited by masijade; 11-11-2009 at 06:09 PM.

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by Arnold View Post
    I'm actually more curious how to make computer programs contact a website and await output from it. There has to be some way...
    HttpURLConnection. It's not that hard. Pretty run of the mill actually, but something that would almost definately kill your performance.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,751
    Rep Power
    19

    Default

    It's Mersenne, isn't it, with an "e"?

  8. #8
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Quote Originally Posted by Tolls View Post
    It's Mersenne, isn't it, with an "e"?
    You'll need to take the rest of the day off work if you are going to be correcting masijade's spellings.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,751
    Rep Power
    19

    Default

    Well, I wouldn't normally, but it was suggested as a Google search...:)

  10. #10
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by Tolls View Post
    It's Mersenne, isn't it, with an "e"?
    Oops! ;-)

  11. #11
    Arnold is offline Member
    Join Date
    Oct 2009
    Location
    Rotterdam
    Posts
    52
    Rep Power
    0

    Default

    Quote Originally Posted by masijade View Post
    HttpURLConnection. It's not that hard. Pretty run of the mill actually, but something that would almost definately kill your performance.
    'run of the mill'??
    We're in the java beginners section now. I didn't understand this URLConnection thing at all.
    Look if I tell you: "Go to that URL, type the following in the designated labels and wait for response", you'd understand me. I don't think it's that simple to give this instruction to Java or any other programming language.

  12. #12
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by Arnold View Post
    'run of the mill'??
    We're in the java beginners section now. I didn't understand this URLConnection thing at all.
    Look if I tell you: "Go to that URL, type the following in the designated labels and wait for response", you'd understand me. I don't think it's that simple to give this instruction to Java or any other programming language.
    Actually, as long as know the semantics of a GET or POST request (and know which the site uses, which you can find out by looking at the source text), yes, in Java, it is (almost, anyway).

    Edit: P.S. A quick look in the API docs would have found this class for you, so claiming "not to know" is not an excuse. And Google would give all sorts of examples. BTW, don't take the "run of the mill" comment as an insult. Of course it is "new" to you, but, in general, it is pretty "run of the mill".
    Last edited by masijade; 11-12-2009 at 02:18 PM.

  13. #13
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    If you are new to Java then don't say it's difficult. Rather say that you don't know how to do it, in which case reading Sun's tutorial will convince you that it really is simple.
    What is worrying is why you are ignoring the other suggestions given as better alternatives.

  14. #14
    Arnold is offline Member
    Join Date
    Oct 2009
    Location
    Rotterdam
    Posts
    52
    Rep Power
    0

    Cool

    Quote Originally Posted by masijade View Post
    Actually, as long as know the semantics of a GET or POST request (and know which the site uses, which you can find out by looking at the source text), yes, in Java, it is (almost, anyway).
    Thank god the site uses the GET method. That wasn't so hard after all! If it used the POST method however, I really wouldn't know what to do.

    I'm sorry to say this, but I found out the site isn't so free after all. every IP has an allowance of 200000000 bits per day.

Similar Threads

  1. Replies: 14
    Last Post: 10-19-2009, 10:57 AM
  2. Replies: 8
    Last Post: 04-19-2009, 05:50 PM
  3. Random
    By koolhoney in forum New To Java
    Replies: 11
    Last Post: 09-30-2008, 03:39 AM
  4. Using Random
    By razmyasdfg in forum CLDC and MIDP
    Replies: 1
    Last Post: 07-27-2008, 10:47 PM
  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
  •