From e76ad04207c2b1d43876a2d37e610fde5a94c87f Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 11 Nov 2018 19:53:49 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=A0=ED=98=95=20=EB=9E=9C=EB=8D=A4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EA=B0=92=EC=9D=B4=20=EC=9D=8C=EC=88=98?= =?UTF-8?q?=EA=B0=80=20=EB=93=A4=EC=96=B4=EA=B0=80=EB=8A=94=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EB=B3=B4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sammo/Util.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sammo/Util.php b/src/sammo/Util.php index 71fd9384..b341314c 100644 --- a/src/sammo/Util.php +++ b/src/sammo/Util.php @@ -460,6 +460,9 @@ class Util extends \utilphp\util $rd = self::randF()*$sum; foreach ($items as $key=>$value) { + if($value <= 0){ + $value = 0; + } if ($rd <= $value) { return $key; } @@ -490,6 +493,9 @@ class Util extends \utilphp\util $rd = self::randF()*$sum; foreach ($items as [$item, $value]) { + if($value <= 0){ + $value = 0; + } if ($rd <= $value) { return $item; }