randomDouble static method

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

Generate random double within range

min - Minimum value max - Maximum value Returns random double within range

Implementation

static double randomDouble(double min, double max) {
  if (min > max) throw ArgumentError('Min value cannot be greater than max value');
  final random = DateTime.now().millisecondsSinceEpoch / 1000.0;
  return min + (random % (max - min));
}