shuffle<T> static method

List<T> shuffle<T>(
  1. Iterable<T> list, {
  2. int? seed,
})

Returns a shuffled copy of list. Pass seed for determinism.

Implementation

static List<T> shuffle<T>(Iterable<T> list, {int? seed}) {
  final rng = seed == null ? _random : Random(seed);
  return list.toList()..shuffle(rng);
}