sudde gameeef wrote:i am making a game where i need to create object only onces randomly. <br/>
i can get random number by random object. but not sure how to put in if statment. <br/>
I'm not sure I understand the question. Are you sure you've read
and understood the java.util.Random API? (and BTW, it's '
Random', not '
random' - that sort of stuff is
very important in
Java).
The reason I ask is that I don't see any attempt to call one of its methods in your code.
Normally, I'd suggest using the online tutorials; but unfortunately they still seem to be stuck on using
Math.random(), which is vastly inferior to the
Random class.
This page seems to provide a quick intro with a few examples though.
Winston