Need help understanding math.random method.
I'm trying to make an applet show 3 random images with 1 image containing text each time it is closed or restarted.
What confuses me even more is that I have to make a random flag after the start() method to determine which image should be shown.
here is the project to help clarify:
In your applet, randomly show an image when the applet is started or restarted. Also, print a message on the applet, depending on which image is shown. Hints: the start() method would be a good place to put some sort of random flag to determine which image should be shown. It is also a good place to call a separate method to set the image and message. The paint() method should only do the actual drawing of the image and the message. Separate methods can be created to set the image and the message into variables for the paint() method to use.
Re: Need help understanding math.random method.
Math is a Class offered by the Java library. It has the method Random().
With out explaining too much about how it works, it might be easier for you to look up in Google: "Java dice roller"
This will give you code to select a number 1, 2, or 3 randomly, which I think will suit your purposes.