Tips

Tips

39M Downloads

[Suggestion] Random selection without replacement

AngleWyrm10 opened this issue ยท 2 comments

commented

It would be nice to see something that isn't just randomly selecting from the set of all tips, where the same tips can pop up during the same presentation of tips.

A way to do that would be instead of using a random roll against the set of all tips, create a temporary copy of the set of all tips as a bag of tips for the presentation session, and then draw one tip out of the bag each time a new tip is presented.

Random selection without replacement: random shuffle a list of tips once at the start, and then just pop one from the end every time another tip is needed.

If the list runs out of tips, refill the temporary list, re-shuffle, and carry on.

commented

Thanks for the suggestion, I will look into adding this. Could just iterate the shuffled copy and wrap around rather than treating it like a stack.

commented

Yeah that seems like it could be even more efficient :)