random<T> static method
Returns a random element of list. Throws when list is empty.
Implementation
static T random<T>(List<T> list) {
if (list.isEmpty) throw ArgumentError('list must not be empty');
return list[_random.nextInt(list.length)];
}