Skip to content

The way to properly serialize Pickup instance #9

Description

@ababich

What is the task:

imagine I need 10 element with weighted probabilities

  1. I initialized Pickup object with weights like {a: 80, b: 20} and got result

list = [a a a b a a a a b a]

  1. After that I "consumed" 2 first elements: list = [a b a a a a b a]

And I need to fill the end, i.e. pick 2 more items

  1. If I init new pickup object with same probabilities I will get different result from what I can have if I will be able to reuse previous (original) object

And these results are worse, especially with low-probability keys

So the easiest way is to serialize and store the initial object but I do not see any straightforward way to do so.

Can you please help?

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions