Modified the playlist shuffling algorithm to avoid placing two instances of the same track next to each other. It checks the IDs of the tracks before and after the positions of the tracks that will be swapped, and if there's a match, it tries again with a new position.

It tries a maximum of 10 times, which should be far more than enough for normal situations. It uses the PlaylistTracks table in the database to get its track ID numbers. I didn't notice any significant performance decreases, even with hundreds of the same 10-15 tracks in the AutoDJ playlist.
Finished modified shuffling algorithm

Here's a brief description of how the algorithm now works:
Loop through the set of tracks to be shuffled:
    1) Set Track A as the current point in the shuffle set
    2) Repeat a maximum of 10 times or until a good place (1/4 of the
       playlist away from a conflict) is reached:
        a) Pick a random track within the shuffle set (Track B)
        b) Check 1/4 of the playlist up and down (clamped at the
           beginning and end) from Track B's position for Track A
        c) Check 1/4 of the playlist up and down (clamped at the
           beginning and end) from Track A's position for Track B
        d) If there was a conflict, store the position if it was better
           than the already stored best position. The position is deemed
           "better" if the distance (square of the difference) of
           the closest conflict (Track B near Track A's position and vv)
           is larger than previous iterations.
3) If no good place was found, use the stored best position
4) Swap Track A and Track B

The "tempTrackDistance" variable in the following might be confusing:
...
            for (int count=startPosition; count < endPosition; count++) {
                if (trackPositionIds.value(count) == trackBId && count != trackBPosition) {
                    conflictFound = true;
                    int tempTrackDistance =
                        (trackAPosition - count) * (trackAPosition - count);
                    if (tempTrackDistance < trackDistance || trackDistance == -1)
                        trackDistance = tempTrackDistance;
                }
            }
...
The reason it is there is to prevent a longer distance from being saved in
the case that there are multiple conflicts within the range.

The section of code that checks around Track A's and Track B's position is
repetitive; I chose to leave it that way for clarity for now but perhaps
it would be better to extract it into a private function?

I have also renamed a few variables and fixed some comment typos for clarity.
Tidied up code

Made a few changes to match the coding guidelines for Mixxx.
Completed improved shuffling algorithm

The algorithm now "wraps" around the playlist, so that if the tracks are re-queued they will still be 1/4 of the playlist apart.
The most extreme case that this algorithm can now handle is a 4-track playlist with two copies of one of the tracks.
Minor style fixes
Merge pull request #287 from zak-reynolds/master

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