Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1449

Re: Generating a random number on a ball

Newsgroups comp.lang.java.help
Subject Re: Generating a random number on a ball
From Ian Shef <invalid@avoiding.spam>
References <18f0d020-b1ab-42fe-aaca-94d193a393f2@y6g2000yqe.googlegroups.com> <m1j7d7dj14j9fhn80jcfsnb7p03nujo584@4ax.com> <gnt6pl0t0agl$.1j1jobujp7x3w.dlg@40tude.net> <JJ-dnTn9OL9kYXrTnZ2dnUVZ_gOdnZ2d@earthlink.com>
Message-ID <Xns9FBC75229BE97vaj4088ianshef@138.125.254.103> (permalink)
Date 2011-12-15 18:30 +0000
Organization Raytheon Company

Show all headers | View raw


Patricia Shanahan <pats@acm.org> wrote in news:JJ-
dnTn9OL9kYXrTnZ2dnUVZ_gOdnZ2d@earthlink.com:

> Joerg Meier wrote:
>> On Mon, 28 Nov 2011 10:02:01 -0800, Roedy Green wrote:
>> 
>>> I don't see your random number code. See
>>> http://mindprod.com/jgloss/pseudorandom.html
>>> for how to generate the numbers Getting the number on the ball in 2D
>>> is a matter of knowing where the ball is and doing a drawString.
>> 
>> I looked at that and randomly saw:
>> 
>> "Don┤ use two different generators with a null seed."
>> 
>> Do you mean "0" seed, or no seed ? Because the Random constructor will not
>> take null.
> 
> No seed. The problem is that the default seed may not have changed, so
> the two generators may be returning the same sequence of numbers.
> 
> Patricia
> 

This will also be a problem if two random number generators are seeded with 
identical seeds (e.g. 0).

If you are using two random number generators, you should supply the seeds 
for both of them, and the seeds should be different.  If you supply the seed 
to only one of them, you stand a possibility (although small) that it is 
identical to the default seed used for the other.


Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Generating a random number on a ball Michael Adedeji <yankosmgt@gmail.com> - 2011-11-28 05:53 -0800
  Re: Generating a random number on a ball Patricia Shanahan <pats@acm.org> - 2011-11-28 07:04 -0800
  Re: Generating a random number on a ball Roedy Green <see_website@mindprod.com.invalid> - 2011-11-28 10:02 -0800
    Re: Generating a random number on a ball Joerg Meier <joergmmeier@arcor.de> - 2011-12-14 01:20 +0100
      Re: Generating a random number on a ball Patricia Shanahan <pats@acm.org> - 2011-12-13 17:33 -0800
        Re: Generating a random number on a ball Ian Shef <invalid@avoiding.spam> - 2011-12-15 18:30 +0000
          Re: Generating a random number on a ball Patricia Shanahan <pats@acm.org> - 2011-12-15 13:11 -0800

csiph-web