From 86658384727263762d8151063aadcbcbebbbdd2c Mon Sep 17 00:00:00 2001 From: Hide_D Date: Tue, 17 May 2022 23:10:52 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20RandUtil=20nextBool=20false=20=EC=97=94?= =?UTF-8?q?=ED=8A=B8=EB=A1=9C=ED=94=BC=20=EC=A0=88=EC=95=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/ts/util/RandUtil.ts | 3 +++ src/sammo/RandUtil.php | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hwe/ts/util/RandUtil.ts b/hwe/ts/util/RandUtil.ts index 8a778fd4..ef3d4908 100644 --- a/hwe/ts/util/RandUtil.ts +++ b/hwe/ts/util/RandUtil.ts @@ -35,6 +35,9 @@ export class RandUtil { if (prob === 0.5){ return this.nextBit(); } + if (prob <= 0){ + return false; + } return this.nextFloat1() < prob; } diff --git a/src/sammo/RandUtil.php b/src/sammo/RandUtil.php index 962fd5c4..591214d2 100644 --- a/src/sammo/RandUtil.php +++ b/src/sammo/RandUtil.php @@ -42,9 +42,12 @@ class RandUtil if ($prob >= 1) { return true; } - if($prob === 0.5){ + if ($prob === 0.5){ return $this->nextBit(); } + if ($prob <= 0){ + return false; + } return $this->nextFloat1() < $prob; }