core/queue: Adjust random track selection

Dividing queue size by 3 seems to give a better distribution of tracks,
but only for a large set of tracks (such as the entire collection).
let's skip the division if the queue only has a small number of tracks.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-03-23 11:33:22 -04:00
parent 6358124ce8
commit 4323461bc6
1 changed files with 2 additions and 1 deletions

View File

@ -185,7 +185,8 @@ struct track *queue_next(struct queue *queue)
if (size == 1)
_q_iter_set(&queue->q_tracks, &queue->q_cur, 0);
else if (queue_has_flag(queue, Q_RANDOM)) {
pos = queue->q_cur.it_pos + random_range(1, size / 2);
pos = random_range(1, (size < 15) ? size : size / 3);
pos += queue->q_cur.it_pos;
_q_iter_set(&queue->q_tracks, &queue->q_cur, pos % size);
} else {
_q_iter_next(&queue->q_cur);