I googled and found this:
Now at the end, the article states “There are a number of ways this could be improved. It could keep track of the song it was last playing and make sure not to play it twice in a row. It could also loop through them, shuffling the array each time, so that it will have the maximum amount of time between each song repeating while still playing a random song. This snippet is just a simple song manager.”
Any ideas on how to do this?