Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #1399
| Date | 2011-11-28 07:04 -0800 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.help |
| Subject | Re: Generating a random number on a ball |
| References | <18f0d020-b1ab-42fe-aaca-94d193a393f2@y6g2000yqe.googlegroups.com> |
| Message-ID | <xMadnXcwJ7WUPk7TnZ2dnUVZ_tGdnZ2d@earthlink.com> (permalink) |
On 11/28/2011 5:53 AM, Michael Adedeji wrote: > I want to generate a random number on the ball...when the game is > started...after two the ball might have move two places on the > screen..i want the random number to show on the ball..until the > program is stop. Any help? thanks ... You are, in effect, trying to solve several problems at once: Generate a random number with the distribution you want. Pick a new number at program-appropriate times. Display text on the ball. Change the text at program-appropriate times. Move the ball according to a chosen number. If I were trying to do this I would break it down into small pieces like this, and work on each one of them separately. If I did not already know how to do one of the things, I would first test it in a very small, simple program. Testing the rest of the code is much easier if you are not playing with random numbers during the test. With random choice, you cannot tell if the number failed to change due to a bug, or because two consecutive spins of the random number generator got the same answer. You would be much less likely to get stuck doing it that way. If you did get stuck, you would have an SSCCE you could post when asking about a specific problem. Patricia
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar
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