CollectionExtensions<T> extension

on

Methods

random() → T?

Available on Iterable<T>, provided by the CollectionExtensions extension

Returns a random element from the collection. If there are no items, returns null. If there's only one item, returns that item.