I'm gonna asume that you understand for loops and can create the 100 numbers. To create a random number use Math.random() to get a number between 0 and 1. Then multiply by 20 because you need 20 different numbers. then add 1 to get results from 1 to 20.999 instead of 0-19.999. Then, asuming you want whole integer numbers, cast the resulting double to and int. There you go. Not too hard.
for(int xx = 1; xx <= 100; xx++)
{
int rnd = (int)(Math.rand om()*(20)+1);
System.out.prin tln("Random number #"+xx+" = "+rnd);
}
As Ganon said, google the Random class (requires import java.util.Rando m;) and if you're having trouble understanding it, come back and we'll help you then.
Comment