sequence static method

List<int> sequence(
  1. int min, [
  2. int? max
])

Generates a random sequence of integers starting from 0 like: 0,1,2,3...??

  • min minimum value of the integer that will be generated. If 'max' is omitted, then 'max' is set to 'min' and 'min' is set to 0.
  • max (optional) maximum value of the float that will be generated. Defaults to 'min' if omitted. Returns generated array of integers.

Implementation

static List<int> sequence(int min, [int? max]) {
  max = max ?? min;
  var count = RandomInteger.nextInteger(min, max);

  var result = <int>[];
  for (var i = 0; i < count; i++) {
    result.add(i);
  }

  return result;
}