diff --git a/Math/Functions/Functions.php b/Math/Functions/Functions.php index c68dc3883..8c435b3d6 100644 --- a/Math/Functions/Functions.php +++ b/Math/Functions/Functions.php @@ -205,4 +205,28 @@ class Functions return $t; } + + public static function mod($a, $b) { + if($a < 0) { + return ($a + $b) % $b; + } + + return $a % $b; + } + + public static function isOdd($a) : int { + if ($a & 1) { + return true; + } + + return false; + } + + public static function isEven($a) : int { + if ($a & 1) { + return false; + } + + return true; + } }