shuffle<T> function Sorting data

List<T> shuffle<T>(
  1. List<T> list, [
  2. int start = 0,
  3. int? stop
])

Randomizes the order of the specified list in-place using the Fisher–Yates shuffle and returns the list.

If start is specified, it is the starting index (inclusive) of the list to shuffle; if start is not specified, it defaults to zero. If stop is specified, it is the ending index (exclusive) of the list to shuffle; if stop is not specified, it defaults to list.length. For example, to shuffle the first ten elements of the list: shuffle(list, 0, 10).

Implementation

List<T> shuffle<T>(List<T> list, [int start = 0, int? stop]) =>
    shuffler<T>(random)(list, start, stop);