You need to look at how you first generate random numbers and fill your array.

You simply generate one number, create a new array with the number, sort the array, then do the same thing again.
...