Playlist shuffle algorithm

So this isn't really a request for help, per se, but I'm hoping someone's come across it at some point.
Does anyone know what the iPod's algorithm is for shuffling, at least a playlist? I know the old discussion of "playing favorites" has been discussed to death, but I've observed an odd seeming trend...not only will it play the same artists, but it'll keep coming back to a single album. And it's not that it does this once, or likes a given album. I've been playing through all my music to rate all the songs (so I play the unrated music), and fairly frequently, I'll find it playing multiple songs (3, 4, 5, haven't counted exact numbers) from one album within a small number of tracks. So it'll play something like A, B, C, A, D, A, E, F, G, H, A... (where those are albums).
I know that this can (and will) happen on random plays, and maybe I'm just remember the times it does happen. But it's also crossed my mind that the algorithm for shuffling could very well involve choosing a psuedo-random number and advancing that many unplayed tracks in the playlist. If the numbers are somewhat periodic, this could end up looping the list to a certain block of tracks (which I'm assuming here are sorted by album) repeatedly.
Of course, I can accept the possibility that it's just me, too I'm just curious what the actual algorithm is, or, if it's patented, what the patent number is. I'm perfectly happy to read through that, too.

Jonathan,
Every computer programmer has various random number generators to choose from. We used a canned program within our Stats package to generate a random number for each observation, then we would sort by that number to ‘randomize’ the observations.
I suspect that the iPod is doing something similar. No sense in spending too much energy creating something new or proprietary for such a simple task.
It could also be doing a stratified random sample, pulling proportionally from each album or another attribute, but I doubt it.
My small tests suggest that the iPod is not using the 1st song (or other easily repeatable base) as a 'seed' for the randomization. It may be using the time (as many computer programs do). That will eliminate the possibility of easily recreating the same 'random' sort order.
My observations indicate that the algorithm creates a randomized total list for the iPod's Playlist. You can manually scroll through the complete Playlist without a repeat (I’ve verified this). However, if you let the iPod Sleep, or exit out to the main menu and re-enter the playlist, the random list of songs to be played will be recreated from the beginning.
This is how most folks get the idea that the shuffle function is not random. They do not realize that the list gets reset every now and then. More so if they are actively manipulating their iPod’s menu.
The shuffle feature is not truly random, as each song is placed on a sequence that will not change once you start playing songs (unless it is reset as I described above). A truly random list would 'randomly' select the next song based on all songs being available - including the ones just played.
Much like a well-shuffled deck of cards, every now and then (actually quite often), you will find some ‘run’ of cards that make a ‘pattern’: same suit, same value, straights, etc. Same thing with music and Artists, Albums, Genre, etc.
Now I've got 'Weird Al' Yankovic's 'Patterns' song running through my head. Gotta go poke out my mind's ear with a flaming stick.

Similar Messages

  • Playlist shuffle problems

    I'm having issues with playlist shuffling on my iPhone 4, and the only discussion I found with the same problem remained unanswered.  I have a playlist of various classical music that I want to shuffle randomly, and it won't.  If I play it in order, all 53 songs will play and can repeat in order.  If I select "Shuffle" from the list of songs, or if I hit the blue "shuffle" icon on the cover art, it changes from "1 of 53" to either "1 of 8" or "1 of 9" (depending on which song happens to be playing).  The smaller groups don't seem to be based by artist or by album, but I can't get it to shuffle all 53 songs. I tried making a smart playlist by genre, and I tried making the playlist manually.  Nothing seems to work.  I have another mixed playlist with various artists and multiple albums, and it functions normally: I can get it to shuffle randomly through all 51 songs across albums and artists no problem.  There must be some property of the music files or the playlists that I'm missing that's causing this bug, but I'm at my wit's end.  Any suggestions?

    Do all the songs in your playlist have a check in the box to the left of each song's name?  Songs without a check will be ignored unless specifically selected to play. If you don't see the checkboxes, go to iTunes > Preferences > General and check "Show list checkboxes".
    To check or uncheck all boxes on a Mac with one click, hold down the Command (cmd) key and click on one of the checkboxes with the mouse.  You can use this in a library, a playlist or in search results.
    If the check marks are not the source of your problem, select one of the songs that won't play when shuffling. Open the song's information window (cmd + I or File > Get Info) and click the Options tab. Check that "Skip when shuiffling" is not checked.

  • With the new version of iTunes, I cannot seem to have the playlist shuffled so that it is shuffled when downloaded to a CD.  Please help.

    With the new version of iTunes, I cannot seem to have the playlist shuffled so that it is shuffled when downloaded to a CD.  Please help.

    Press Alt or Ctrl+B.
    tt2

  • Making A Playlist Shuffle?

    Is it possible to make a playlist shuffle, so you can add all the music and it won't play the same band till all the songs you chose are through with that artist?

    Ya, in the iPod settings, if you set it so it shuffles music, your playlists will be shuffled as well. At least it certainly is working that way on mine. Even when I pull up an artist and a specific album to listen to, it shuffles that album. So in my experience it is the iPod's setting that determines if shuffles is ON or not and if it is ON, then everything gets shuffled, library, play list, album, etc.
    Patrick

  • ITunes playlist shuffle feature

    I have always found the iTunes playlist shuffle feature fails to play all my songs and only accesses a narrow selection and then repeats thes without ever playing a broad selection of my playlist. Is there a way to overcome this?

    Yes. Go to SETTINGS > SHUFFLE, and set it to SONGS. Then, go back, highlight the name of your playlist and press PLAY. It will play just that playlist, and it will be shuffled.
    CHeers!
    -Bryan

  • Review my shuffling algorithms

    I've started developing a card game and got quite interested in shuffling algorithms.
    From http://en.wikipedia.org/wiki/Shuffle#Shuffling_algorithms it seems that there are two popular ones.
    1. Assign a random number to each card then order the cards by this number.
    2. Knuth Shuffle
    Here's my shameful attempt at the first one, I'm in desperate need of pointers to improve this.
         //Assign a random number to each card in the deck
         //then sort the cards in order of their random numbers
         public void AssignRandomNumberShuffle()
              //Create an array of random numbers
              //This array will correspond to the Card array
              double[] randomNumbers = new double[cards.length];
              for(int i=0;i<randomNumbers.length;i++)
                   randomNumbers[i] = Math.random();
              //Create a new array to store the random numbers
              //Then sort it in ascending order
              double[] sortedNumbers = (double[])randomNumbers.clone();
              Arrays.sort(sortedNumbers);
              //Create a temporary Card array to store the new order
              Card[] tempCards = new Card[52];
              //Find the new position of the card and store it in the temp array
              for(int i=0;i<randomNumbers.length;i++)
                   int newPosition = Arrays.binarySearch(sortedNumbers,randomNumbers);
                   tempCards[newPosition] = cards[i];
              cards = tempCards;
         }I think my Knuth Shuffle is implemented correctly but it'd be good to have it checked by someone else in case it's not, or if it could be made more efficient. Here is the code for it.//Knuth Shuffle
    //Move through the pack from top to bottom, swapping each card
    //in turn with another card from a random position in the part of
    //the pack that has not yet been passed through (including itself).
         public void KnuthShuffle()
         Random randomGenerator = new Random();
         for (int i = cards.length-1; i > 0 ; i--)
              //Get random value between 0 and i (+1 so i is included)
              int randomPosition = randomGenerator.nextInt(i)+1;
              //Swap the current card with the random card
              Card tempCard = cards[i];
              cards[i] = cards[randomPosition];
              cards[randomPosition] = tempCard;
    I might as well add the following, in which I use the built in shuffle method in Collections, it may be useful to someone.//Shuffle using the built in shuffle in java.util.Collections
    public void JavaCollectionShuffle()
    //Convert to a list, shuffle, then convert back to array
    List<Card> list = Arrays.asList(cards);
    Collections.shuffle(list);
    cards = (Card[])list.toArray();
    The Knuth shuffle and the Collections.shuffle both take roughly the same amount of time to run, doing about 1,000,000 shuffles and the other shuffle takes much longer, expectedly.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    JosAH wrote:
    Martin... wrote:
    Any more comments about the shuffles? Maybe a better way to code the AssignRandomNumberShuffle()?Well, Knuth's method has already been implemented by the Collections.shuffle() method; read the API documentation.I have read that; read my first post, I use Collections.shuffle().
    I wanted to implement the Knuth shuffle myself for learning and understanding purposes. My implementation of the algorithm runs at virtually the same speed as the Collections.shuffle() so I'm pretty happy with it.
    The AssignRandomNumberShuffle() on the other hand...
    Here's the Collections.shuffle() method
    public static void shuffle(List<?> list, Random rnd) {
            int size = list.size();
            if (size < SHUFFLE_THRESHOLD || list instanceof RandomAccess) {
                for (int i=size; i>1; i--)
                    swap(list, i-1, rnd.nextInt(i));
            } else {
                Object arr[] = list.toArray();
                // Shuffle array
                for (int i=size; i>1; i--)
                    swap(arr, i-1, rnd.nextInt(i));
                // Dump array back into list
                ListIterator it = list.listIterator();
                for (int i=0; i<arr.length; i++) {
                    it.next();
                    it.set(arr);
    }And mine, which has changed since first post.public void KnuthShuffle()
    Random randomGenerator = new Random();
    for (int i = cardList.size()-1; i > 0 ; i--)
    //Get random value between 0 and i (+1 so i is included)
    int randomPosition = randomGenerator.nextInt(i+1);
    //Swap the current card with the random card
    Collections.swap(cardList, i, randomPosition);
         }Now I'm a bit worried that my for loop is for i>0 and theirs is i>1...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Why is my iPod Touch 4th generation playlist shuffle repeat malfunctioning?

    I have a 4th generation iPod touch that is malfunctioning whenever I shuffle play a playlist, album, or individual artist's songs. I always leave the playlist repeat option on when I listen to a playlist or artist and all the songs in the playlist will play fine, but when the playlist ends and is supposed to start over from the beginning it does not play the first song that began the shuffle. It plays a different song that is in the playlist in the first slot and then continues in the same order as the first time through the playlist. For example I have 5 songs by the Eli Young Band on my ipod & when I play these 5 songs on shuffle with the loop option on their order through the first play through is Say Goodnight, When It Rains, Crazy Girl, Always the Love Songs, and Even if it Breaks Your Heart. Then after the fifth song the playlist begins again but instead of playing Say Goodnight in the one spot it played Even if it Breaks Your Heart followed by When It Rains, Crazy Girl, Always the Love Songs, and finishes with Even If It Breaks You Heart. So in the second play through of the playlist Say Goodnight was skipped & Even if it Breaks Your Heart was played twice & I can't figure our why. This happens with every artist and playlist I have no matter how many songs are in the playlist, and a different song is placed in the one spot and then repeated later every time the playlist repeats. The ipod has done this since I got it in December 2012, and I have already tried turning the ipod off and back on and restoring it to factory settings to try and solve this problem with no luck. I have also installed the iOS 6.1 software and the problem still persists. Any solutions to this problem would be greatly appreciated.

    Try hitting the button again so it shows the replay sign and a little #1 in the top right corner of the icon.

  • Still no playlist shuffle order view in iTunes 11.0.1. Alternatives?

    iTunes 11.0.1 has not restored the ability to view and export playlists in shuffled order. Does anyone know of a good Mac alternative to iTunes?

    View > Show Status Bar will out the b=grey bar back on the bottom where your data will be displayed

  • Why aren't my playlists shuffled?

    When I look at a playlist on my computer, the playlists are shuffled. But on my iPod, the lists stay in alphabetical order. I've reset my iPod, restarted my computer, connected the iPod, disconnected the iPod. Any other suggestions?

    On the iPod, go to SETTINGS > SHUFFLE and set it to SONGS. Then, go back & play a playlist & it will play shuffled.
    Cheers!
    -Bryan

  • Playlist shuffle is working even when the button is off...Im using Ipod shuffle 4th gen*

    Im using Ipod shuffle 4th gen...And I am not able to stop the songs getting shuffled....For example I want my ipod the play the songs one by one...but its not working...Its shuffling songs by default...I mean the button which stops shuffling the songs(the on off button when placed in the iddle stops shuffling songs) is NOT working....What to do?

    If you are trying to play a playlist in the order shown for that playlist (in iTunes), you need to be IN the playlist on the shuffle.  You may be in the main "all songs" list on the shuffle, and not a particular playlist.  Note: You can have multiple playlists on 4th (and 3rd) gen shuffle, which is why there is a separate "all songs" list.
    This article explains how to use VoiceOver, including how to change between playlists.
    http://support.apple.com/kb/HT4322
    (See Changing playlists and To choose an item from the playlist menu.)

  • Playlist shuffle for Ipod Nano?  or am I stuck with same order of songs?

    Is there a shuffle option for the nano where I can vary the order of the songs played? It gets really onld knowing which song is going to come on next.

    In the settings menu, make sure that shuffle is set to "songs". Then select any playlist/album/artist/genre etc, then press play (not select). The songs within the category you selected will be shuffled.

  • Playlist Shuffle

    I have several playlists on my iPod including one that contains just Christmas music. I typically shuffle songs between all playlists, but would like to exclude the Christmas playlist except during the season. Is there any way to exclude this one playlist from being included in the shuffle but still allow the rest to shuffle?

    I am not sure if that will stop those songs from playing on the iPod, but I would think that it would.
    However, if it doesn't,
    1. Make a Smart Playlist which can be set a variety of ways:
    You might want to look at the first drop-down menu and decide which of these options might work well for your purposes:
    Album, Artist, Category, Date Added, Genre.
    If they are all in the Holiday Genre, that might work best.
    I hope this helps!

  • Playlist shuffle issues

    Here's the problem,
    Searchin for a specific song using the search box on top of every playlist kicks you out of shuffle.
    that never happened to me before. just this update.
    therefore, if i wanna hear a song within the shuffled playlist, I have to scroll all the way down just to find the song and continue on the shuffled playlist. Does anyone know how to fix this please?
    its just a small thing, but it irritates me coz this never happened before.
    thank you so much!!!

    Thank you so much for propmtly coming to my aid! Unfortunately, I have done both of those things and yet the issue remains, arrrgh.  Just for complete clarification(not do to a lack of understanding on your part, but possibley for future viewers), it's not that it won't shuffle, it's that it doesn't play anything after the current song has finished. I have to manually get it to play something else.  once I turn off shuffle it plays thru my playlist fine.  I tried to play it with repeat on (and yes repeat all not just 1....not that dumb thank god.) and the problem persists.  It's pretty frustrating and I am starting to think that maybe something went awry in my recent update of itunes.  Again, thank you for responding so quickly.  If you have anymore suggestions it would be greatly appreciated.

  • Playlist shuffle help please!

    OKAY! So before, I used to press Shuffle on my Playlist, the songs would become randomly listed. With me so far? I hope!
    NOW! When I press Shuffle on a Playlist, it just start playing songs randomly instead of listing them as well.
    For example, I start with:
    Alice in Chains song
    Alice in Chains song
    Alice in Chains song
    Breaking Benjamin song
    etc.
    Pretty much with all my Artists in alphabetical order.
    Then I would press Shuffle while listening to my playlist and it would be:
    Gorillaz song
    Blue Oyster Cult song
    Flyleaf song
    Metallica song
    etc.
    So now, do I have to MANUALLY move my songs around it order for it to be random? Please tell me there's something that can be done. I really don't feel like manually moving 500+ songs around.

    Right-click the Playlist name, and choose "Copy to Play Order."

  • Playlist shuffle resetting

    Hey all:
    For the longest time I had a 4th gen ipod and (obviously) the previous version of itunes. What I enjoyed doing was creating a regular playlist and putting all my favorite songs in there. Then I would hit shuffle and sync the playlist to my ipod. The shuffled order would stay no matter how many times I synced until I went into the playlist in itunes and reshuffled it (and then I would sync it and the cycle would continue).
    However, I recently purchased a 2nd gen ipod touch and upgraded to itunes 8. Now, I can shuffle the playlist and sync it to my ipod, and the order is shuffled like it's supposed to be on the ipod, but when I resync my ipod to my computer the song order in the playlist resets to the order in which they were added. This is very frustrating, as I like to get through the whole playlist before I start again!
    Thanks for any assistance,
    -CEJ

    Right-click the playlist name and select "Copy to Play Order."

Maybe you are looking for

  • Detect obsolete mitigating control assignments?

    Hello, What report/s would you use to detect obsolete mitigating control assignments? The scenario is: A user has been assigned a mitigating control, let's say during the CUP workflow, to mitigate a certain risk that came with a certain role. Later,

  • How to change gateway in windows 7 from ethernet to usb 4g modem?

    We have a Windows 7 machine that is connected to internet by satelite through ethernet. This workstation also has a USB 4G modem that should be used by a software application. We would like to have all network functionality to go through normal ether

  • Windows authentification while consuming web service from ABAP

    Hi All, We are consuming web service from ABAP, we have created client proxy in SE80 and configured logical port in LPCONFIG. This one was working fine. Now we have added  windows user authentification to access this service. Now when I'm trying to r

  • IMac 24" 3.06Ghz crashes intermittently, causes endless restarts

    Hi All, I have a 24-inch, 3.06 Ghz Intel iMac that has been crashing intermittently for months now. The crashes seem to happen at mostly random times, but occur more frequently during processor-intensive tasks. Specifically, the crashes almost always

  • Error "DIR_TRANS does not exist"

    Hello! I am trying to add the new system to a transport domain. When I try to change the DIR_TRANS parameter in instance profile to point to the common transport directory, I get an error message "DIR_TRANS directory <domserv>\sapmnt\trans does not e