Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #3958 #3965

Merged
merged 1 commit into from
Oct 13, 2024
Merged

fix #3958 #3965

merged 1 commit into from
Oct 13, 2024

Conversation

knighthat
Copy link

Old algorithm

if (songs.size > maxSongsInQueue.number) 
    songs.shuffled().take(maxSongsInQueue.number.toInt())
else
    songs

Shuffle only happens when number of songs is larger than the queue allows.

New algorithm

songs.shuffled().take( maxSongsInQueue )

Shuffle regardless. Besides, List#take will take up to specified number, if list's size is smaller, it'll return all elements, no need to check

@fast4x fast4x merged commit 0ff9428 into fast4x:master Oct 13, 2024
@knighthat knighthat deleted the issue-3958 branch October 19, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants