Giter Club home page Giter Club logo

Comments (6)

mathstuf avatar mathstuf commented on July 4, 2024

It seems as though albums with more songs tend to rise to the top. From 12 "PlayAll" presses from the song list, I saw only 3 different albums first and they tended to be close to the top consistently. I have 100+ albums and the 3 are the ones I have the most songs for.

from vanilla.

mathstuf avatar mathstuf commented on July 4, 2024

Glancing at the code, it would take some more time to go through and see if there are any logic errors. It might me fairer (though slower) to get a list of albums, shuffle it and then expand each album into a list of songs.

from vanilla.

piemonkey avatar piemonkey commented on July 4, 2024

I've been bothered by this too and I've finally got round to writing a solution which is now in my fork. I'll put in a pull request for it to be pulled into a future version.

The old album shuffle was an attempt at a Fisher-Yates shuffle and made the mistake that it picked each album to shuffle by picking a random song in the sorted song list and then finding the start of that album, which means that it was more likely to pick bigger albums first.

Fisher-Yates doesn't really work in this case as the albums are not all the same length, so I just pulled out a list of albums and used Collections.shuffle(). This is basically what you've said mathstuf and it isn't slower, it's faster as the old method did a lot of excess arrayCopys. I've tested it both in code and by repeatedly calling play all and looking at the queue and it seems to me to fix this bug.

from vanilla.

mathstuf avatar mathstuf commented on July 4, 2024

On Mon, Feb 17, 2014 at 15:48:58 -0800, piemonkey wrote:

I've been bothered by this too and I've finally got round to writing a
solution which is now in my fork. I'll put in a pull request for it to
be pulled into a future version.

Woo! Thanks!

The old album shuffle was an attempt at a Fisher-Yates shuffle and
made the mistake that it picked each album to shuffle by picking a
random song in the sorted song list and then finding the start of that
album, which means that it was more likely to pick bigger albums
first.

Hmm. I thought it picked randomly until it found a first-song-in-album.
Maybe I'm remembering incorrectly (it has been a year...).

Fisher-Yates doesn't really work in this case as the albums are not
all the same length, so I just pulled out a list of albums and used
Collections.shuffle(). This is basically what you've said mathstuf and
it isn't slower, it's faster as the old method did a lot of excess
arrayCopys. I've tested it both in code and by repeatedly calling play
all and looking at the queue and it seems to me to fix this bug.

Yeah, that's what I thought when I looked at it, but my Java-fu is weak
and I got frustrated fighting against Eclipse.

from vanilla.

piemonkey avatar piemonkey commented on July 4, 2024

"I thought it picked randomly until it found a first-song-in-album."

In the first while loop within the album shuffle for loop it takes the random j value, checks if the corresponding song is the start of an album and if not does j -= 1. What it should maybe have done is pick another random j but that would have slowed it down even further.

from vanilla.

adrian-bl avatar adrian-bl commented on July 4, 2024

Closing this old bug as the patch from issue 71 was already merged

from vanilla.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.