randomBetween function

int randomBetween(
  1. int from,
  2. int to
)

Implementation

int randomBetween(int from, int to) {
  if (from > to) throw Exception('$from cannot be > $to');
  var rand = Random();
  return ((to - from) * rand.nextDouble()).toInt() + from;
}