xemle / home-gallery

Self-hosted open-source web gallery to view your photos and videos featuring mobile-friendly, tagging and AI powered image discovery
https://home-gallery.org
MIT License
805 stars 61 forks source link

Adding srandom sort method for more random results #100

Closed vityav closed 10 months ago

vityav commented 10 months ago

Addresses issue https://github.com/xemle/home-gallery/issues/99 by implementing a Durstenfeld shuffle on the entire array of query results. Allows distinct srandom sorting from random for the purposes of testing and validation.

xemle commented 10 months ago

Thank you very much for this PR. I will test it at Tuesday and I am curios for the result of the improved random order.

vityav commented 10 months ago

Hopefully it's useful! I gave it some tests with various other query parameters (e.g. "year: 2015 order by srandom") and it works well for me, but will be good to know it works in general.

xemle commented 10 months ago

Hi @vityav.

Thank you for providing this PR. I like the functionality and the improvement.

Would you mind if I take your PR as base and refactor it? I would use your algorithm for order by random.

xemle commented 10 months ago

Merged in 7342158 and released in 1.14.0