range method

int range(
  1. int minOrMax, [
  2. int? max
])

Get a random integer between 0 (inclusive) and minOrMax (exclusive), or between minOrMax (inclusive) and max (exclusive) if max is given.

Implementation

int range(int minOrMax, [int? max]) =>
    max == null ? nextInt(minOrMax) : nextInt(max - minOrMax) + minOrMax;