int32s method

List<Int32> int32s(
  1. int count, {
  2. int min = 0,
  3. int? max,
})

generates a list containing count random Int32s whose values fall between min (inclusive) and max (exclusive) if passed, the value of min must be limited to a 32-bit max value; passing a number outside the 32-bit space will throw an ArgumentError

Implementation

List<Int32> int32s($core.int count, {$core.int min = 0, $core.int? max}) {
  max ??= Int32.MAX_VALUE.toInt(); // -- force default even if `null` is explicitly passed

  if (Int32.MAX_VALUE < min) {
    throw ArgumentError('Value of `min` must be a 32-bit number');
  }

  return List.generate(count, (i) => int32(min: min, max: max));
}