doubleR function

double doubleR({
  1. int min = 0,
  2. int max = 1,
  3. int decimal = -1,
})

return a double between min to max.

decimal is double retain decimal places.

because of the naming conflict, I added an 'R' letter.

Implementation

double doubleR({int min = 0, int max = 1, int decimal = -1}) {
  final result = _random.nextDouble() * (max - min) + min;
  return decimal < 0 ? result : double.parse(result.toStringAsFixed(decimal));
}