randomValue method

T? randomValue({
  1. int? max,
  2. int min = 0,
  3. int? seed,
})

Retrieves a random value from the provided list.

Parameters:

  • data: The list of values.
  • max: The maximum index to use for selecting a value.
  • 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'];
String? randomValue = options.randomValue(options, max: 4, min: 1, seed: 42);
// Result: Random value from the list 'B'.

Implementation

T? randomValue({int? max, int min = 0, int? seed}) {
  return RandomProvider.value(this, max: max, min: min, seed: seed);
}