random method
Returns a random element from this collection using the specified source of randomness.
Implementation
E random([Random? random]) {
if (isEmpty) throw NoSuchElementException('Collection is empty.');
random ??= Random();
return this[random.nextInt(length - 1)];
}