package maguen_3;
import java.util.Arrays;
public class Maguen_3_test {
    public static void main(String[] args) {
        randomPLaylist(10);
    }
    public static void randomPLaylist(int num) {
        int[] songsArray = new int[num];
        for(int i = 0; i < num; i++) {
            songsArray[i] = (int)(Math.random()*num) + 1;
            for(int j = 0; j < i; j++) {
                if(songsArray[i] == songsArray[j]){
                    i--;
                    break;
                }
            }
        }
        System.out.println(Arrays.toString(songsArray));
    }
}
This is a small program that shuffles a playlist. The function randomPlaylist receives the length of the playlist. I know intuitively that it is O(n * log n), but I don't know how to explain it with words.
 
     
    