The standard
Java library already has a method to shuffle a List:
Collections.shuffle(list). If you need to shuffle an array, you can use
Arrays.asList(array) to wrap the array as a list.
So to shuffle your array of Track objects you could just do:
If you need to implement this yourself (for example because it's homework and you're supposed to implement it yourself), see
Fisher–Yates shuffle for an explanation of a good and simple shuffling algorithm.