randomRangeIntClamp static method

int randomRangeIntClamp(
  1. num min,
  2. num max,
  3. num clamp
)

Returns a pseudo-random int number between parameters min and max, clamping the returned value to clamp. Doesn't check for errors: Parameters can not be null; And min > max.

Implementation

@pragma("vm:prefer-inline")
static int randomRangeIntClamp(num min, num max, num clamp) {
  return (randomRangeInt(min.toInt(), max.toInt()) / clamp.toInt()).round() *
      clamp.toInt();
}