Closed dhardy closed 1 month ago
@newpavlov what do you mean? IndexedRandom::choose
already borrows &self
.
Do you mean choose_and_remove
? If so, it will have more restrictions on the containing type than Index<usize>
(or mut variant); e.g. it could be implemented on a Vec
but would be inefficient.
Never mind, I misunderstood the API.
CHANGELOG.md
entrySummary
982 requests the addition of
choose_multiple_fill
, but for the given use-case (fixed-length output), an array appears more appropriate.Details
This requires additional code in
rand::seq::index
. Under the assumption that the array length is small, it is reasonable to skip the algorithm-selection-logic and always use Floyd's alg for the new fn.Additional
Two new modules under
rand::seq
for cleaner code organisation.