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

[Suggestion] Random selection without replacement #99

Open
AngleWyrm10 opened this issue Oct 28, 2022 · 2 comments
Open

[Suggestion] Random selection without replacement #99

AngleWyrm10 opened this issue Oct 28, 2022 · 2 comments

Comments

@AngleWyrm10
Copy link

AngleWyrm10 commented Oct 28, 2022

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.

@Darkhax
Copy link
Member

Darkhax commented Oct 29, 2022

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.

@AngleWyrm10
Copy link
Author

AngleWyrm10 commented Nov 9, 2022

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

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

No branches or pull requests

2 participants