fastrand

Function choice

Source
pub fn choice<I>(iter: I) -> Option<I::Item>
Available on crate feature std only.
Expand description

Choose an item from an iterator at random.

This function may have an unexpected result if the len() property of the iterator does not match the actual number of items in the iterator. If the iterator is empty, this returns None.