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; }