randomItem<T> static method
Picks a random item from iterable
and returns it.
Uses randomInt internally to select an item index.
An instance of _math.Random can optionally be passed to customize the random sample distribution.
Implementation
static T randomItem<T>(Iterable<T> iterable, [_math.Random? random]) {
random = random ?? _math.Random();
return iterable.elementAt(
randomInt(0, iterable.length, random),
);
}