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

Papel Shop: Investigate weighted random picker #39

Open
jchv opened this issue Jul 6, 2023 · 0 comments
Open

Papel Shop: Investigate weighted random picker #39

jchv opened this issue Jul 6, 2023 · 0 comments

Comments

@jchv
Copy link
Contributor

jchv commented Jul 6, 2023

We currently use a simple weighted random algorithm with a static linear spread of weights. One issue with this system is that it requires us to potentially draw more times to actually pick an item in cases where repeats cannot happen, which may mess with the distribution a bit.

It would be nice if we had a somewhat efficient way to pick a random item that has not already been picked. One such way would be to track the weights of each index, so that a picker function could subtract them from the total, and then skip that amount if the random happens to land on it. This could be inefficient in some cases, esp. if a large number of random choices need to be picked out of a large pool, but it should work well for the use case of picking a few items out of a large set. For such cases where we need to pick every item out of a pool, another weighted randomizer optimized for that task could be employed instead.

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

1 participant