This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes util.Random problems (?) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "util.Random problems (?)" Watch "util.Random problems (?)" New topic
Author

util.Random problems (?)

Svend Rost
Ranch Hand

Joined: Oct 23, 2002
Posts: 904
Hi..

Im fooling around with a small particle engine for J2ME, and
for each particle (in the particle flock) I need to generate
a beginning x and y value, and an "update/speed vector" (xi,yi) with the
help of Random.

Emperical tests shows, that the particles tend to flock together.
I suspect, that util.Random "reuses" the generated values..

does anyone have any info on the above?

In general about the engine:

loop thru' the flock of particles:
if particle p is active -> p.update
else reset p

particle.update()
x= x + xi
y= y + yi

particle.reset()
sets the x,y,xi and yi values with random.nextInt() % 3

/Svend Rost
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: util.Random problems (?)
 
Similar Threads
How to execute a file xi.java from package ?
how do i rotate a point from a center point??
i finish building the fuction but in certain cases..
Why synchronization here?
Executable-Java!