rangeDouble function

TValueGenerator rangeDouble(
  1. double min,
  2. double max, {
  3. required Random random,
})

Returns a generator that produces a random double in [min, max) on each call.

Throws ArgumentError if max is not greater than min.

Implementation

TValueGenerator rangeDouble(
  double min,
  double max, {
  required Random random,
}) {
  _requireMinLessThanMax(min, max);
  return () => min + (random.nextDouble() * (max - min));
}