integer method

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

Generates a random integer with the given max (exclusive) value and to the lowest min (inclusive) value if provided.

Example:

random.integer(10);

random.integer(10, min: 5);

Implementation

int integer(int max, {int min = 0}) =>
    max == min ? max : _random.nextInt(max - min) + min;