shuffle method
Shuffles the elements of this list randomly.
final numbers = <int>[1, 2, 3, 4, 5];
numbers.shuffle();
print(numbers); // [1, 3, 4, 5, 2] OR some other random result.
Implementation
@override
void shuffle([Random? random]) {
// This is highly inefficient for a linked list.
// Convert to list, shuffle, then rebuild.
final List<E> temp = toList();
temp.shuffle(random);
clear();
addAll(temp);
}