You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
@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!).
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.
The text was updated successfully, but these errors were encountered: