selecting random percentage would not reliably garuantee the precise percentage of selected elements
now randomize an index array instead and use the precise number of elements from this array
Details
Details
- Reviewers
Campbell Barton (campbellbarton)
Diff Detail
Diff Detail
Event Timeline
Comment Actions
This wont work correctly with hidden elements.
It could work like this...
- create an array of pointers the total size of elements.
- loop over all elements and add visible elements to the array.
- shuffle the array (only taking into account the total number of elements added).
- calculate the number of items to select based on the number of items added to the array multiplied by the selection percentage.
- Loop over and select the first items in the array.