Function fastrand::choice

source ·
pub fn choice<I>(iter: I) -> Option<I::Item>
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.