random method
Returns a random element from the list.
Implementation
E random([Random? random]) {
assert(isNotEmpty, "Can't get a random element from an empty list");
final randomGenerator = random ?? randomFallback;
return this[randomGenerator.nextInt(length)];
}