distantInt method

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

Implementation

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