Fix for Bug #1023804: Stop AutoDJ shuffle from putting two of the same song together

I've modified the shuffling algorithm to try to keep 1/4 of the length of the playlist between tracks. It works in both normal and extreme situations at an acceptable rate, still taking a fraction of a second shuffling a playlist of 1600+ of the same 80 tracks. Details of the algorithm can be found in the comments and the 2nd commit message. I've tried to adhere to the style guidelines but this is my first time contributing, so I'm all ears if I've missed anything!
Just want to check to make sure, does placing this utility function here (and not making it a private member of the class) fit within the style?