# How does Random actually work? (Music)

Posted 18th Jul
In my car I play music through a 64gb usb stick, so literally thousands of songs.

I stick it on random and leave it like that, but it seems to play the same songs quite a lot.

For example I have all the Alice In Chains albums on it, but three times this week it has played the same AIC track, same with Guns N' Roses and lots of other bands.

Is there some algorithm that random uses to select tracks?
How does it decide which tracks to play?

It doesn't seem like it is actually random as constantly hearing the same songs, although it does now and then throw out songs that it hasn't played before.
Is there some algorithm that random uses to select tracks?
How does it decide which tracks to play?

Every time the listener uses random play function, the music fairy rolls a D20 dice to select the track to play.
Iâ€™ve often thought the same with my iPod. At the moment there are 16000+ tracks on there and I permanently have it on shuffle. However in a single session I will usually get multiple tracks from the same artist which seems unlikely given the choice. I wondered if the algorithm was somehow restricted to a range of storage or index
I had a car which had a shuffle feature, if you selected shuffle it would put the songs in an order for itself to play, but they would always be in that same order, so Band A with Album B would always play songs 3,6,1,4,2,8,9 etc everytime you played them. Can't remember if it reset itself when you unplugged the USB, but I think it used some algorithm to pick which order, so would always pick the same order.
MIDURIX18/07/2020 09:18

I had a car which had a shuffle feature, if you selected shuffle it would â€¦I had a car which had a shuffle feature, if you selected shuffle it would put the songs in an order for itself to play, but they would always be in that same order, so Band A with Album B would always play songs 3,6,1,4,2,8,9 etc everytime you played them. Can't remember if it reset itself when you unplugged the USB, but I think it used some algorithm to pick which order, so would always pick the same order.

I've tried fooling it by skipping to a song it never plays but always seems to find it's way back to the same songs.
StokeMeAClipper18/07/2020 07:36

Interesting, but still seems suspicious to me!

I would prefer a randomiser that plays every track once, just in a random order.
So for example with 10 tracks, it plays, 2, 7, 4, 1, 10, 9, 8, 6, 4, 3, 5 then starts again, never playing track 2 again until it had gone through all the others.
I saw a post on Reddit on someone checking how Spotify does it, itâ€™s an algorithm itâ€™s not actually random they really donâ€™t want you playing the same song which a genuine random shuffle could lead too
i don't think random in song shuffle works properly as i have noticed this on my phone. i only have a list of 15 songs and when it is on shuffle, some songs never seem to get played and the same song would get played twice instead in an hour span.

doesn't really work properly.
So what u are saying is that the take that and boyzone songs are never played??
The only real answer to "How does Random actually work?" is that it depends on how it's been implemented in your device.

Even if you said what you're playing your music on, it might still be impossible to answer the question unless someone here wrote the software for it.

There are so many different ways to do "random", such as reordering all tracks, or literally just picking a random new one when the previous track ends (which could result in repeats close to each other, or even play the same song again if the software doesn't explicitly avoid it).

And then to complicate matters even more, consumer electronic devices aren't actually capable of generating random numbers anyway, so they generate a sequence of pseudorandom numbers instead. If you're lucky, this will be well-implemented and use something like the car's clock or remember where it left off in order to seed what appears to be a truly random selection of music.

I've seen some cheaper stereos that seem to use a fixed random seed, so all the random feature does is play the tracks in what appears to be a random order at first, but it will play them in exactly the same order again next time you get in your car.

It's also possible that some stereos simply have a really bad pseudorandom number generator implementation that doesn't result in a uniform distribution if you have a large number of tracks, so some tracks will appear to be played more than others (because they are!)

Also, with huge numbers of tracks, there's also the human error possibility - if you have 9 copies of Barbie Girl on your USB stick, it's going to be played 9 times more often than any other track, although that's possibly not your only problem there
paul_merton18/07/2020 15:07

Also, with huge numbers of tracks, there's also the human error â€¦Also, with huge numbers of tracks, there's also the human error possibility - if you have 9 copies of Barbie Girl on your USB stick, it's going to be played 9 times more often than any other track, although that's possibly not your only problem there

That's one thing I sorted out, spent hours going through all my music making sure I only had one of each track, each track had correct title and only tracks I actually liked instead of just everything by a band.
Satan_Claws18/07/2020 11:28

Interesting, but still seems suspicious to me! I would prefer a randomiser â€¦Interesting, but still seems suspicious to me! I would prefer a randomiser that plays every track once, just in a random order.So for example with 10 tracks, it plays, 2, 7, 4, 1, 10, 9, 8, 6, 4, 3, 5 then starts again, never playing track 2 again until it had gone through all the others.

That's not remotely random though. I used a random number generating site online to generate ten random numbers between 1 and 10, it gave me:
3 5 10 10 7 6 5 8 10 6

So 10 is played three times, 5 and 6 are both played twice and 1, 2, 3, and 9 are not played at all.

Random means anything can happen, which includes clusters, groups and duplicates

There have been attempts to come up with a less random algorithm that removes the occurances that people see as patterns, and various attempts have been implemented in various players, but as far as I know there's not been one that everyone has settled on.
EndlessWaves18/07/2020 16:35

That's not remotely random though. I used a random number generating site â€¦That's not remotely random though. I used a random number generating site online to generate ten random numbers between 1 and 10, it gave me:3 5 10 10 7 6 5 8 10 6So 10 is played three times, 5 and 6 are both played twice and 1, 2, 3, and 9 are not played at all. Random means anything can happen, which includes clusters, groups and duplicatesThere have been attempts to come up with a less random algorithm that removes the occurances that people see as patterns, and various attempts have been implemented in various players, but as far as I know there's not been one that everyone has settled on.

I agree what I proposed isn't really random, and thinking about it still not exactly what I want.

I always assumed I was just seeing patterns but it just seems really weird to hear the same tracks again and again, there are 57 Alice In Chains songs on there, yet it only ever plays the same one. I suppose that is the problem with true random though.

Just checked and there are approximatly 8000 tracks on the stick.

I guess what I want is for it to randomly select tracks but use some kind of algorithm so there is at least a certain amount of tracks played before replaying one that has already appeared since starting.
EndlessWaves18/07/2020 16:35

That's not remotely random though. I used a random number generating site â€¦That's not remotely random though. I used a random number generating site online to generate ten random numbers between 1 and 10, it gave me:3 5 10 10 7 6 5 8 10 6So 10 is played three times, 5 and 6 are both played twice and 1, 2, 3, and 9 are not played at all. Random means anything can happen, which includes clusters, groups and duplicatesThere have been attempts to come up with a less random algorithm that removes the occurances that people see as patterns, and various attempts have been implemented in various players, but as far as I know there's not been one that everyone has settled on.

for music tracks, the random generator needs to exclude the track number that has already been generated in the cycle, so it doesn't appear again. not impossible to do this.
What about fobts? They are supposed to be random but I lose more than I win