views:

71

answers:

4

Backstory:

So I was driving to band practice this evening. My car has a USB port where you can plug in a USB stick with MP3 files on it and the stereo will play them. I have about 100 MP3s on my stick so I pushed the 'Random' button. So from here to band practice, it played:

  • Track 22
  • Track 45
  • Track 4
  • Track 11
  • Track 87
  • Track 66
  • Track 98

Then on the way home, it played

  • Track 16
  • Track 27
  • Track 33

And then I stopped at the petrol station. I filled up, got back in the car and the stereo fired up again. It played

  • Track 22
  • Track 45
  • Track 4
  • Track 11
  • Track 87

I thought, WTF? What's with this 'random' generator? What are they using as a seed, if not time? Is a car stereo so memory-tight that it can't even use the C stdlib? Does anyone know how this kind of thing happens?

+1  A: 

Without looking at the code of the music player it's hard to say. Some thoughts:

  1. It may be that it created a random playlist, then started the playlist again at the beginning. E.g., a random sequence which it then repeated, as opposed to independently coming up with the same sequence from its random number generator twice.
  2. Or, of course, it is using time as its seed and its clock is messed up and sometimes reading 0 or something, resulting in the repeated sequence.
  3. Or (with apologies) observational error. :-)
T.J. Crowder
Yeah, but this has only happened a couple of times. Maybe once every 10 times I start the car up. So most of the time, it's random, but sometimes it just repeats a previous sequence.
Duracell
@Duracell: That sounds a lot like #2 on my list. :-) But I like #1 as well.
T.J. Crowder
A: 

It may be that the embedded device controlling the randomization doesn't have a clock. Perhaps it uses the number of tracks as seed or something similar.

If you don't have some external source for random seeds, such as readings from a clock, the software will, when all it's memory is reset, behave deterministically each time it is started.

aioobe
So they can decode MP3 but they can't perform decent randomization?
Duracell
Well without a clock or something similar, the software is completely deterministic.
aioobe
Without a clock they could use the count of total times you have pressed 'play all' as a seed.
Tom Gullen
That's why I wrote "when all it's memory is reset". If it has memory, it doesn't need a seed, since you could remember the state of the random generator from one run to another.
aioobe
@Duracell: "So they can decode MP3 but they can't perform decent randomization?" Yeah, correct. Such mass products are usually a mix of self-contained subproduct components. Licensing an MP3 decoder is easy. Integrating it with the rest of the world is a different story, and here the rule "the cheaper they are, the less they care" applies.
TheBlastOne
+1  A: 

MP3 players tend to generate a random playlist when you select the random option, then play the same playlist.

The only 'random' part is that the playlist changes each time you re-set the 'random' option.

As an example, the iPod shuffle mp3 player has a functionality that allows you to re-shuffle the songs in order to generate a new 'random' playlist.

Thibault Falise
A: 

It's important to remember that without good statistical analysis our psychology lends to the fact that we spot patterns even when they don't exist (for all intents and purposes).

For example, if you had 10 songs on your iPod, there is a high chance when you play all ten songs in 2 sets, that there will be tracks next to each other in both sets. Our brains are wired to spot and notice that.

If the pattern you describe is true, then yes, they probably messed up their code a little. Perhaps the internal system time resets every time the device is powered off, so when you turn it on by pressing 'play all' instead of 'switch on' then 'play all' it might play the same tracks in the same order. Or perhaps time isn't used as a seed.

Or, perhaps (unlikely) it is random. A truly random sequence will repeat orders eventually, especially in such a small set of 100 it's not beyond the realms of possibility you will see repeats in subsets of the data.

Tom Gullen