range method
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;