Hi
I was just wondering if someone could help me a bit in my java code.
Basically what iv done is made a program that chooses 15 numbers between 1 and 100.
I was wondering if there was an easier way of writting each array for these fifteen numbers.
As of now i have written each code individually like this:
//Array Numbers Random randomGenerator = new Random (); int num[] = new int[16]; for (int idx = 1 ; idx < 16 ; idx++) { num[idx] = (int)(Math.random()*100); } c.println("Here are 15 random numbers between 1 and 100:"); c.println (num[1]); c.println (num[2]); c.println (num[3]); c.println (num[4]); c.println (num[5]); c.println (num[6]); c.println (num[7]); c.println (num[8]); c.println (num[9]); c.println (num[10]); c.println (num[11]); c.println (num[12]); c.println (num[13]); c.println (num[14]); c.println (num[15]); }
The program goes work, i was just interested in finding out whether there was an easier way to put these random number.