sample<T> method
Samples n items from a list without replacement.
Implementation
List<T> sample<T>(List<T> items, int n) {
assert(n <= items.length);
final shuffled = List<T>.from(items);
shuffle(shuffled);
return shuffled.take(n).toList();
}