nearInt method

int nearInt(
  1. int max, {
  2. double bias = 1.0,
})

Implementation

int nearInt(int max, {double bias = 1.0}) {
  if (max <= 1) return 0;
  final result =
      (max * math.pow(nextDouble(), 1 / (1 + bias))).toInt();
  return result.clamp(0, max - 1);
}