randomInt function

int randomInt(
  1. int max, {
  2. int min = 0,
})

Implementation

int randomInt(int max, {int min = 0}) {
  if (min > max) {
    throw Exception('min cannot be greater than max but $min > $max');
  }
  return min + _random.nextInt(max - min);
}