shuffle
Returns the elements in a random order (Fisher–Yates: every permutation is equally likely),
leaving items as it is.
The order depends only on the generator, so the same seed always gives the same result.
Import
Section titled “Import”Cargo feature random (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
items | &[T] | The elements to shuffle. |
rng | &mut Rng | The generator that decides the order. |
Returns
Section titled “Returns”Vec<T> — A new Vec with the same elements in a random order.
