public static function numberWrap($val, $min, $max)
    {
        while (!self::numberBetween($val, $min, $max)) {
            if ($val < $min) {
                $val += $max - $min + 1; // +1 because $min
            } elseif ($val > $max) {     // and $max are
                $val -= $max - $min + 1; // inclusives
            }
        }
        return $val;
    }