1. Attachments are working again! Check out this thread for more details and to report any other bugs.

CD Player's "RAND" not really random

Discussion in 'Gen 3 Prius Audio and Electronics' started by Tideland Prius, Jun 20, 2010.

  1. Tideland Prius

    Tideland Prius Moderator of the North
    Staff Member

    Joined:
    Oct 2, 2004
    45,024
    16,242
    41
    Location:
    Canada
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    Anyone bothered by the fact that the CD player in the Prius isn't really random at all? After describing the scenario, if you use an iPod, BT Audio or a USB thumbdrive, lemme know if the same RAND logic is used... Hopefully it's just an MP3 CD issue.


    I have an MP3 CD with 2 folders. Let's say I just play one folder (~110 songs)

    1. If I want to randomly skip a song, there appears to be 7 or 8 songs that it "chooses" and will cycle through them (not necessarily on order. I have had it cycle between 2 songs a few times before deciding on another song in that "random list")

    2. I leave it in RAND and after 1 year, there are at least 30 songs that it has NEVER played. I even forgot I had them in the CD because the JBL audio never even cycles through them.

    3. Choosing a song manually at random doesn't seem to change up the "random list" that the audio plays. It'll play the song then go back to playing the same 30 or 40 songs (the remaining have been played at least once)


    Has anyone else noticed this? Does it do the same if it's playing an iPod?
     
  2. mikegoldnj

    mikegoldnj New Member

    Joined:
    May 2, 2010
    21
    3
    0
    Location:
    New Jersey
    Vehicle:
    2010 Prius
    Model:
    IV
    The CD changer in my Nissan Altima, when on Random All, would randomly select from across all six discs.

    The Random on the Prius changer seems to only select from within one folder, on one disc.
     
  3. Tideland Prius

    Tideland Prius Moderator of the North
    Staff Member

    Joined:
    Oct 2, 2004
    45,024
    16,242
    41
    Location:
    Canada
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    DISC. RAND only applies if you have regular CDs in there. The Prius will do DISC RAND across all 4 or 6 CD trays.

    With an MP3 CD, it will do FLR. RAND which will make it play all folders on one MP3 disc "randomly"
     
  4. macman408

    macman408 Electron Guidance Counselor

    Joined:
    Mar 21, 2010
    1,179
    367
    1
    Location:
    California
    Vehicle:
    2010 Prius
    Model:
    V
    Never tried it, since I use my iPhone for audio. But this has been a common complaint to Apple about iPods and iTunes for many, many years.

    The truth is, these systems really ARE random, it's just that us humans are good at picking out patterns. For a while, Apple even introduced a slider in the iTunes preferences to make the shuffle seem more random by reducing the probability of playing a second song from the same artist and album, even though doing so actually makes the sequence of songs LESS random. But it feels more random to you, because you're hearing a wider variety.

    It does depend on the algorithm used; for example, my iPod plays songs randomly without replacement: that means that if I set it on random and let it play forever, it will play through every song once before it plays any song a second time. If I reboot the iPod, or explicitly choose a song (rather than just skipping forward/back), that resets the list so it will choose from all songs again. On the other hand, iTunes DJ (previously known as Party Shuffle) is random with replacement: that means that each song played is chosen from all available songs. If I have five songs to choose from, I'm just as likely to get song A five times in a row as I am to get A, then B, then C, then D, then E. (Percentage-wise, either of those will happen 0.032% of the time, or one in every 3125 times.) On the other hand, it's 4 times more likely that I'll get A, then B, then C, then D, then anything but E (0.128%). Of course, to restrict it a lot less, if I say you play 5 random songs, the chances are that you will repeat at least one of them is 96.16%; the other 3.84% of the time, you'll get one of the 120 different ways that you can play each song exactly once. You have to play at least 8 songs to get a 50% chance of playing every one at least once (if I did my math right). And if you play 15 songs, there's still a 10% chance that you haven't played at least one of them. And that's with only 5 songs to choose from!

    Sadly, I can't remember the math to calculate the probability of your situation; but it doesn't sound non-random to me at all.

    That said, there's two points to be made:
    1. This doesn't preclude that there could still be a bug. That would require extensive testing and mathematics, however.
    2. Your point is noted; it doesn't FEEL random, even if it mathematically is. You would undoubtedly rather have it feel random than have some nerd like me try to prove to you that it is random. As is often the case in humanity, emotions trump logic.
     
  5. Tideland Prius

    Tideland Prius Moderator of the North
    Staff Member

    Joined:
    Oct 2, 2004
    45,024
    16,242
    41
    Location:
    Canada
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A

    Good points although the part I quoted is what I'm interested in. Say the Prius follows the iPod and the list is resetted every time I start the car, that still doesn't explain the fact that some songs have *never* been played...
     
  6. qbee42

    qbee42 My other car is a boat

    Joined:
    Mar 2, 2006
    18,058
    3,075
    7
    Location:
    Northern Michigan
    Vehicle:
    2006 Prius
    Just to quibble a bit, but no consumer music player has truly random play. Being computer based, they are pseudo-random. Random computer routines are algorithmic, which means they are actually long repeating patterns. If designed correctly they do a good job mimicking a true random pattern, but they aren't really random.

    Note that none of this invalidates the rest of this posters comments. As I said before, I am simply making a technical quibble. I suppose it could come into play if the pseudo-random generator were poorly written, but even a rookie programmer would do better than what Tideland describes.

    Tom
     
    1 person likes this.
  7. silentak1

    silentak1 Since 2005

    Joined:
    Jul 1, 2005
    893
    28
    0
    Location:
    LA
    Vehicle:
    2010 Prius
    Model:
    III
    Finally someone else who notices the same thing. RAND in any input (CD/US ) is not a true random...i'm thinking of starting to use the ipod via bluetooth so i can do the random/shuffle through the ipod, but I like the song info on the OEM screen. choices choices choices...
     
  8. wick1ert

    wick1ert Senior Member

    Joined:
    Dec 3, 2009
    1,311
    183
    2
    Location:
    Delawhere
    Vehicle:
    2010 Prius
    Model:
    III
    My Civic hybrid, when on random using a CF card, would actually play them in random-order, per se. It didn't play song 1,2,3,4,etc but would play them in the same non-sequential order. It took me a couple weeks to realize it (hey, I only drive about 10-15 mins at a time for most of my trips). It got to the point where I knew how many times I needed to FF past songs to get to the one I wanted to hear at that moment.

    I just let my iPod Touch shuffle or listen to the radio now.
     
  9. NoMoShocks

    NoMoShocks Electrical Engineer

    Joined:
    Jan 21, 2007
    1,292
    82
    11
    Location:
    Camas, WA
    Vehicle:
    2010 Prius
    Model:
    IV
    It is obvious that your Prius and you have differnt tasts in music. It will play the songs it doesn't like if you ask nicely, but if you let it pick the songs, it will stick to songs it likes best.
     
  10. dtuite

    dtuite Silverback

    Joined:
    Mar 25, 2010
    182
    31
    0
    Location:
    Redwood City, CA
    Vehicle:
    2010 Prius
    Model:
    II
    It still blows my mind that my engineering-school _Handbook of Chemistry and Physics_ had *tables* of random numbers! I used to keep that old "Rubber Bible" shelved right next to Arthur C. Clarkes _The Nine Billion Names of God_."
     
  11. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    6,035
    3,855
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    Yes it does. It is a very low possibility that they have never played over the course of a year, but that is the nature of "random". If there is no replacement, then eventually it will play. Leave your car on for a month, and Im sure the song will come back to the top (assuming your music collection can be fully played in a months time). If there is replacement, then there is no guarentee any song will ever play, but there is a guarantee that a song will play. It could very well pick the same song every time and never advance.

    Also, I have that same technical quibble. There is no such thing as random in any computer system. Generally it is a number that counts in some direction starting at some base number and some other increment/decrement and every clock cycle changes. This is then modulo'd over the number of songs (easiest way, but lots of others too), and gives a basic random generator.
     
  12. GeekEV

    GeekEV Member

    Joined:
    Sep 12, 2006
    417
    14
    0
    Location:
    NorCal, USA
    Vehicle:
    2006 Prius
    Model:
    N/A
    The notion of random is pretty funny. Couple that with the human mind's capacity for finding patterns where none exist and you get some very strange observations. Keep in mind, in a truly random setup, it's just as likely to play every song IN ORDER as it is to play any other combination of songs. Still technically random, but not to our brain it's not. I remember reading some years ago about how Apple actually has some "un-randomization" code in iTunes and iPod to take some of the randomness out so as to make *us* feel like it's MORE random. Go figure.
     
  13. rrolff

    rrolff Prius Surgeon

    Joined:
    Aug 19, 2009
    1,610
    246
    0
    Location:
    So Cal
    Vehicle:
    2010 Prius
    Model:
    III
    And to quibble just a bit more, the odds of having a true random generator in any general appliance is very slim.

    There are a few good random number generators in the oepn source world - but they require a random input (to start) - and getting a true random start is near impossible without a special purpose chip :cool:
     
  14. silentak1

    silentak1 Since 2005

    Joined:
    Jul 1, 2005
    893
    28
    0
    Location:
    LA
    Vehicle:
    2010 Prius
    Model:
    III
    ok you guys totally overkilled the "random coding" topic. Does anyone want to re-write the sequence or random logic? :D
     
  15. jrflip

    jrflip New Member

    Joined:
    Apr 14, 2009
    15
    3
    0
    Location:
    new jersey
    Vehicle:
    2010 Prius
    Model:
    IV
    There are two random options.
    1. Play songs on one disc "randomly."
    2. Play all songs on all discs "randomly."
     
  16. qbee42

    qbee42 My other car is a boat

    Joined:
    Mar 2, 2006
    18,058
    3,075
    7
    Location:
    Northern Michigan
    Vehicle:
    2006 Prius
    With systems started by human users it's pretty easy to get a good seed based on the truly random time that the user hits the start button, unless there is some sort of timing constraint limiting when the start button is pushed.

    One of the big problems with good pseudo random generators are the very large number of permutations that can be generated for a small number of items. For example, none of the computer card games give a truly random deal of cards. There are too many permutations for any reasonable variable precision.

    Getting back to the original topic, what most users want for random music play is really randomized non-repeating patterns. Typically people want their music player to step through all of the songs in the list without repetition, but do so in some randomized way.

    Tom
     
  17. rrolff

    rrolff Prius Surgeon

    Joined:
    Aug 19, 2009
    1,610
    246
    0
    Location:
    So Cal
    Vehicle:
    2010 Prius
    Model:
    III
    *if* we are talking random numbers, and hence *if* we are talking a true random seed, there is no way a human - starting a car will create a true random seed. It must be designed that way. Pressing "the button" applies power to the system - which is always done in a similar way.

    A random system must start with a truly random seed. This is very simple *if* you have a NIST certified RNG (random number generator) chip to seed the "pseudo" RNG.

    Now - we could play with the light sensor (for headlights located on the dash) - and implemented correctly (using its output), we may come close, or may pass as a RNG - but I think that was not part of the radio design. Using what's on the car, there is {IMHO} no way to produce a truly random event - without some tinkering with some input like a light sensor.

    I do not think Toyota engineers thought about a proper seed - or even a NIST verified/certified algorithm - in their design.....

    Just my $.02
     
  18. qbee42

    qbee42 My other car is a boat

    Joined:
    Mar 2, 2006
    18,058
    3,075
    7
    Location:
    Northern Michigan
    Vehicle:
    2006 Prius
    You are assuming that the entire system is powered off, which it is not. A simple counter incrementing at a very high rate serves as a good seed generator when it is sampled by the power-on keystroke. This is true because the human operator has no knowledge of the state of the counter, and the period of the counter is very small compared to the use of the vehicle. As the counter cycles through its range it is equally probable that any counter value will be selected when the car is powered up.

    This sort of system is very commonly used to seed random number generators in systems that involve a random input.

    Tom
     
  19. rrolff

    rrolff Prius Surgeon

    Joined:
    Aug 19, 2009
    1,610
    246
    0
    Location:
    So Cal
    Vehicle:
    2010 Prius
    Model:
    III
    Well put - but still way off base.

    Any system that requires a 'touch' is relying on that 'touch' to be random. In fact, I could study the system - watch its workings, and get a good idea of how to replicate an event in the past (working on the knowledge of the system and how it powers up).

    With good study, I could recreate that original event. This would mean the system was not random.

    It may take me 1000 years, but my great great ... great grand child would prove your point invalid. Likely with the correct measuring devices, this could be cut down a bit.

    To be fair, the 1000 year estimate is just that - and has no relation to anything scientific - a guess at best assuming how long it takes to power on the device - and knowing more about the 'system'.

    EDIT: I would add that the system we are talking about is 90+% likely to not be 'running' - as in system (CPU) clock - this drains battery and is pointless. More likely is some SRAM based clock chip which runs low power, and keeps the system correct in our time frame.
     
  20. Tideland Prius

    Tideland Prius Moderator of the North
    Staff Member

    Joined:
    Oct 2, 2004
    45,024
    16,242
    41
    Location:
    Canada
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    Ok.. let me put it another way. It's a lot less random than any other music player (hifi, walkman or mp3) I've own. With nearly 120 songs to play, you'd figure I won't hear one song for at least a week. I can hear the same song 3 times on the same 20 min drive.