From 22b32f2acee2cd145837bfd22144126837676704 Mon Sep 17 00:00:00 2001 From: kupferchen Date: Wed, 13 Dec 2023 16:42:06 +0100 Subject: [PATCH 1/2] MBS-8483: warnings and bugs php 8.2 --- question.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/question.php b/question.php index 1a92839..4fcfa98 100644 --- a/question.php +++ b/question.php @@ -587,7 +587,7 @@ public static function randomize_vars(array &$vars, array $inequalities, $timeli * @return int|float Random number in the set {x| $min <= x <= $max, x = $min + n * $increment, n ∈ N} */ public static function random_incremented_value($min, $max, $increment) { - return $min + mt_rand(0, ($max - $min) / $increment) * $increment; + return $min + mt_rand(0, (int)round(($max - $min) / $increment)) * $increment; } /** From 8a9cd63d749f543eec00c97f0af90539fd600e31 Mon Sep 17 00:00:00 2001 From: Philipp Memmel Date: Wed, 17 Jan 2024 13:39:33 +0000 Subject: [PATCH 2/2] MBS-8483: Use intval instead of (int)round(...) --- question.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/question.php b/question.php index 4fcfa98..e838269 100644 --- a/question.php +++ b/question.php @@ -587,7 +587,7 @@ public static function randomize_vars(array &$vars, array $inequalities, $timeli * @return int|float Random number in the set {x| $min <= x <= $max, x = $min + n * $increment, n ∈ N} */ public static function random_incremented_value($min, $max, $increment) { - return $min + mt_rand(0, (int)round(($max - $min) / $increment)) * $increment; + return $min + mt_rand(0, intval(($max - $min) / $increment)) * $increment; } /**