in reply to Music shuffling

well ..., if you want to add some code back in and your don't play criterion is "I heard it recently", then you could tag pushed back songs with a "last played" time and then base the portion of the array that you may chose from on the set of songs that haven't been played recently.


Perl is environmentally friendly - it saves trees

Replies are listed 'Best First'.
Re^2: Music shuffling
by oko1 (Deacon) on Jul 08, 2008 at 16:10 UTC

    That's close to what I did originally: a hash with the array indexes as keys and timestamps as values, plus a weighted sort. It just seemed too complicated for the job I was trying to do... not anything I could point to code-wise, just a sense of "dammit, I know there's got to be a more graceful way to do this - this is just too fiddly!"

    Your idea, and what I did here - only using a portion of the array - would have worked better than my original implementation, though. That one still came up with occasional doubles, or "too-near"s.

    
    -- 
    Human history becomes more and more a race between education and catastrophe. -- HG Wells