Skip to content

feat: add random sorting #1029

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TheBobBobs
Copy link
Contributor

A basic implementation of a random sort. Uses a seed to allow for pagination without changing order. Clicking search will generate a new seed.

Tasks Completed

  • Platforms Tested:
    • Windows x86
    • Windows ARM
    • macOS x86
    • macOS ARM
    • Linux x86
    • Linux ARM
  • Tested For:
    • Basic functionality
    • PyInstaller executable

@CyanVoxel CyanVoxel added Type: Enhancement New feature or request TagStudio: Library Relating to the TagStudio library system Status: Review Needed A review of this is needed labels Aug 12, 2025
@CyanVoxel CyanVoxel added this to the Alpha v9.5.4 milestone Aug 12, 2025
@CyanVoxel CyanVoxel moved this to 🏓 Ready for Review in TagStudio Development Aug 12, 2025
@purpletennisball
Copy link
Contributor

Tested this out and it seems all good but just a suggestion: Maybe have the seed change on refresh? (Cmd/Ctrl+R)

Comment on lines +916 to +917
case SortingModeEnum.RANDOM:
sort_on = func.sin(Entry.id + search.random_seed)
Copy link
Collaborator

@Computerdores Computerdores Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit skeptical about the randomness of this. I would have done it like this (would also have a different order every time), on the other hand, the randomness of this isn't that important so as long as it is good enough this could be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random() doesn't support passing in a seed so changing pages would give a new order. Using sin() allows consistent ordering when moving between pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review Needed A review of this is needed TagStudio: Library Relating to the TagStudio library system Type: Enhancement New feature or request
Projects
Status: 🏓 Ready for Review
Development

Successfully merging this pull request may close these issues.

4 participants