Module rand::seq::index

source ·
Available on crate feature alloc only.
Expand description

Low-level API for sampling indices

Enums§

Functions§

  • Randomly sample exactly amount distinct indices from 0..length, and return them in random order (fully shuffled).
  • Randomly sample exactly amount distinct indices from 0..length, and return them in an arbitrary order (there is no guarantee of shuffling or ordering). The weights are to be provided by the input function weights, which will be called once for each index.