randomInt function

int randomInt(
  1. int min,
  2. int max
)

Returns a random integer from min to max, inclusive.

Implementation

int randomInt(int min, int max) {
  if (min > max) {
    throw RangeError('max must be greater than min');
  }
  return (_random.nextDouble() * (max - min + 1) + min).floor();
}