Kiwi Posted October 26, 2012 Share Posted October 26, 2012 In my programming class we are learning Java, and we had a speed code challenege. I was first <3 We had to create a program that had an array of 10 integers and you then had to make it generate 10 random numbers between 1 - 10 and add them to the array.. Here is my code ;) //Coded by Kiwi //creates a random number and adds it to the array public class randomArray { public static void main(String[] args) { int[] randArray = new int[10]; for(int i = 0; i < randArray.length; i++) { int tempNum = (int)(Math.random() * 10 + 1); randArray = tempNum; System.out.println(randArray); } } } Link to comment Share on other sites More sharing options...
Ryitus Posted October 26, 2012 Share Posted October 26, 2012 /tears in eyes, I remember when i use to code html Link to comment Share on other sites More sharing options...
Vinerlly Posted October 26, 2012 Share Posted October 26, 2012 My brain is fried by your intelligence! Link to comment Share on other sites More sharing options...
Kiwi Posted October 26, 2012 Author Share Posted October 26, 2012 /tears in eyes, I remember when i use to code html <3 you better be proud of me ! My brain is fried by your intelligence! Awww shucks :3 also, my code is 10 lines.. Everyone elses was over 15-20 :') I'm a hero Link to comment Share on other sites More sharing options...
Maninas Posted October 26, 2012 Share Posted October 26, 2012 Could've been shorter if you just put the brackets in the same line... xD Link to comment Share on other sites More sharing options...
Kiwi Posted October 27, 2012 Author Share Posted October 27, 2012 Could've been shorter if you just put the brackets in the same line... xD we arent allowed Link to comment Share on other sites More sharing options...
meIody- Posted November 29, 2013 Share Posted November 29, 2013 bunp Link to comment Share on other sites More sharing options...
Recommended Posts