Returns the closest number to x int the range 0, y.
x
0, y
int clamp(int x, int y) => x < 0 ? 0 : x > y ? y : x;