float method

double float([
  1. double? minOrMax,
  2. double? max
])

Gets a random floating-point value within the given range.

Implementation

double float([double? minOrMax, double? max]) {
  if (minOrMax == null) {
    return _random.nextDouble();
  } else if (max == null) {
    return _random.nextDouble() * minOrMax;
  } else {
    return _random.nextDouble() * (max - minOrMax) + minOrMax;
  }
}