"Each of the functions should be run with array inputs, of size 100, 1000 and 10000; where each
value in any array should be an integer from 1 – 1000 inclusive. Each sorting function should be
run on arrays of the following types: random numbers, sorted lists and almost sorted lists"
Below I have created three arrays.
First one fills Array of 10000 randomly with integers from 1-1000.
Second fills array of 10000 with integers from 1-10000. Third Shuffles array of 10000 which include integers from 1-10000.
My problem is I can't get my 2nd and 3rd Array of 10000 to only include values from 1-1000. Is is even possible? I'm new to this. Any help will be appreciated!!
int [] inputTenThousand = new int[10000]; // Random 10000 for (int a = 0; a < inputTenThousand.length; a++) { inputTenThousand [a] = (int) (Math.random () * 1000); } int [] inputTenThousand2 = new int[10000] // Sorted 10000 for (int a = 0; a < inputTenThousand2.length; a++) { inputTenThousand2[a] = a + 1; } List<Integer> TenThousandList = new ArrayList<Integer>(); for (int i = 1; i < 10001; i++) { TenThousandList.add(i); } Collections.shuffle(TenThousandList); int[] inputTenThousand3 = new int[TenThousandList.size()]; // Almost Sorted 10000 for (int i = 0; i < TenThousandList.size(); i++) { inputTenThousand3[i] = TenThousandList.get(i); } for (int i = 0; i < inputTenThousand3.length; i++) { inputTenThousand3[i] = TenThousandList.get(i); }