doubleInRange static method

double doubleInRange(
  1. double min,
  2. double max
)

Generates a random double in the given range min, [max).

Implementation

static double doubleInRange(double min, double max) {
  if (min >= max) throw ArgumentError('min must be less than max');
  final rand = math.Random();
  return min + rand.nextDouble() * (max - min);
}