randomInt function
Generates a random integer between the specified min
and max
values.
Implementation
int randomInt([int min = 0, int max = 999999]) {
var n = min.compareAndSwap(max);
min = n.first;
max = n.last;
return min + _random.nextInt(max - min + 1);
}