Skip to content

Add a probs argument to Random.sample #42

@simlmx

Description

@simlmx

Usage example:
random.sample(['choice1', 'choice2'], {probs: [0.6, 0.4]})

This would allow, for instance, choosing different moves or options with different probabilities.

Some details:

  • We don't want to assume the probs sum to one (i.e. we want to normalize).
  • We probably want to change the signature to Random.sample(choices :T[], options: {n: number ,...}) for all methods of Random. This should probably be a prerequisite to the probs new feature.

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