Skip to content

Papel Shop: Investigate weighted random picker #39

Description

@jchv

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions