I need to make a random number from 1 to 20 and based on this number (using the "If-Then" instructions), I need to install an ImageView image.
I know that in Objective-C it looks something like this:
int aNumber = arc4Random() % 20; if (aNumber == 1) { [theImageView setImage:theImage]; }
How can I do this in Java? I saw how this is done, but I do not see how I can set the range of numbers (1-20, 2-7, ect).
int aNumber = (int) Math.random()
Justin
source share