pub fn subsequence<T: Clone + 'static>(
values: impl Into<Cow<'static, [T]>>,
size: impl Into<SizeRange>,
) -> Subsequence<T>
Expand description
Sample subsequences whose size are within size
from the given collection
values
.
A subsequence is a subset of the elements in a collection in the order they occur in that collection. The elements are not chosen to be contiguous.
This is roughly analogous to rand::sample
, except that it guarantees that
the order is preserved.
values
may be a static slice or a Vec
.
ยงPanics
Panics if the maximum size implied by size
is larger than the size of
values
.
Panics if size
is a zero-length range.