randomList method

List<T> randomList({
  1. int? length,
  2. int min = 0,
  3. int? seed,
})

Generates a list of random values from the provided list.

Parameters:

  • data: The list of values.
  • length: The length of the generated list.
  • min: The minimum index to use for selecting a value. Default is 0.
  • seed: Seed for the random number generator. Default is null.

Example:

List<String> options = ['A', 'B', 'C', 'D'];
List<String> randomList = options.randomList(length: 3, min: 1, seed: 42);
// Result: List of 3 random values from the list ['B', 'C', 'D'].

Implementation

List<T> randomList({int? length, int min = 0, int? seed}) {
  return RandomProvider.list(this, length: length, min: min, seed: seed);
}