[−][src]Trait turtle::rand::RandomSlice
This trait represents useful random operations for slices.
You will not typically use this trait directly or even import it.
The shuffle()
and choose()
functions provide all the functionality of
this trait without needing to have it in scope.
Associated Types
type Item
The type of item stored in this slice
Required methods
fn shuffle(&mut self)
Shuffle the slice's elements in place. None of the elements will be modified during this process, only moved.
fn choose(&self) -> Option<&Self::Item>
Chooses a random element from this slice and returns a reference to it.
If the slice is empty, returns None.