clampToInt method
Rounds to nearest int then clamps to min..max.
Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
int clampToInt(int min, int max) {
final int n = round();
if (n < min) return min;
if (n > max) return max;
return n;
}