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

Feature Request: Grid Anti-Duplication #313

Open
HarryCordewener opened this issue Dec 27, 2022 · 2 comments
Open

Feature Request: Grid Anti-Duplication #313

HarryCordewener opened this issue Dec 27, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@HarryCordewener
Copy link

I would love if there was a way if I showed the same scene twice in a Grid, or even across two scenes with a subset of images that overlap, if I could stop a Grid from showing the same picture more than times in the same grid view.

@StarrHelixx StarrHelixx added the enhancement New feature or request label Jun 26, 2023
@r3a1d3a1
Copy link

r3a1d3a1 commented Jan 1, 2024

Not just for grid-view, but in general, the proper randomization algorithm is as follows:
Have an array that contains paths of all files to be shown. Each time an item is randomly chosen from the array, swap it with the last element, and pop(). (for efficiency, o.w. it'd be O(n) to remove it from the middle of the array, as you're unfortunately doing in here)
Once the array is empty (or near empty in case of grid-view), refill it with all the paths again.

@r3a1d3a1
Copy link

r3a1d3a1 commented Jul 7, 2024

@ififfy
Also for the second condition of this line, you could use find instead to check if there's at least one element with a different src than the last item, instead of iterating over all elements (which grows to 120 by default!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants