/** * this is the main class, if you couldn't tell * originally i wasn't supposed to modify it * as you can see, i didn't adhere to that well -.-' * * --------------------------------------------------- * * DO NOT MAKE ANY CHANGES TO THIS CLASS * * too late... besides, it gives you a better idea how much time is left * quite the efficient algorithm, but 10000 numbers is still a lot :P * Runtime: ~6 minutes */ public class RUN_assignment5 // class name modified to match pre-existing // workspace conventions { public static void main(String[] args) { int min = 1; // smallest number that can be generated //note here: max can be changed easily and maintain equal distribution //min, however, cannot, and i don't know why int max = 20; // largest number that can be generated mainApp rg = new mainApp(min, max); // class name modified to match // pre-existing workspace // conventions int num; int[] frequency = new int[max]; for (int x = 0; x < 10000; x++) { num = rg.getRandom(); System.out.println((10000 - x) + " : " + num); if (10000-x == 9000) System.out.println("-------------------9000"); if (10000-x == 8000) System.out.println("-------------------8000"); if (10000-x == 7000) System.out.println("-------------------7000"); if (10000-x == 6000) System.out.println("-------------------6000"); if (10000-x == 5000) System.out.println("-------------------5000"); if (10000-x == 4000) System.out.println("-------------------4000"); if (10000-x == 3000) System.out.println("-------------------3000"); if (10000-x == 2000) System.out.println("-------------------2000"); if (10000-x == 1000) System.out.println("-------------------1000"); for (int index = 0; index < max; index++) // determines frequency { if (num == index + 1) frequency[index]++; } } System.out.println(""); System.out.println("Frequency Distribution"); System.out.println("----------------------"); for (int index = 0; index < max; index++) // displays frequency { System.out.println("" + (index + 1) + " = " + frequency[index]); } } }