use min() and max()

This commit is contained in:
Sunch 2024-08-17 20:07:08 +08:00
parent 9eeaa9600f
commit 0f26e45638
2 changed files with 2 additions and 2 deletions

View file

@ -15,6 +15,6 @@ class LightUtils{
$diffZ = ($source->z - $block->z);
$distance = $diffX*$diffX + $diffY*$diffY + $diffZ*$diffZ;
$result = floor($source->getMaxLightValue() - $distance);
return $result <= 0 ? 0 : $result;
return max($result, 0);
}
}

View file

@ -125,7 +125,7 @@ class MersenneTwister{
$this->init_with_integer(19650218);
$i = 1;
$j = 0;
$k = (N > $key_length ? N : $key_length);
$k = (max(N, $key_length));
for(; $k; $k--){
$mt[$i] = add_3($mt[$i] ^
mul_by_1664525($mt[$i - 1] ^ (($mt[$i - 1] >> 30) & 3)),