Skip to content

Which distribution is realized by choose? #1342

@RalfJung

Description

@RalfJung

The choose functions say that they are picking an element at random, but they don't say according to which distribution. Obviously knowing the distribution is crucial to properly using this function, so I hope this gap in the docs can be fixed.

For slices I strongly assume the distribution is uniform, but for choosing from an iterator, this is much less obvious -- will the distribution always be uniform even if the size_hint is very imprecise? What if the size_hint is wrong?

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