From da3fb2c094121ba8fa2bcc89e29fe3b5902d4bd1 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Tue, 17 May 2022 23:08:03 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20nextBool=EC=97=90=EC=84=9C=200.5?= =?UTF-8?q?=EC=9D=B8=20=EA=B2=BD=EC=9A=B0=20=EC=97=94=ED=8A=B8=EB=A1=9C?= =?UTF-8?q?=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 | 3 +++ 2 files changed, 6 insertions(+) diff --git a/hwe/ts/util/RandUtil.ts b/hwe/ts/util/RandUtil.ts index eb6e940d..8a778fd4 100644 --- a/hwe/ts/util/RandUtil.ts +++ b/hwe/ts/util/RandUtil.ts @@ -32,6 +32,9 @@ export class RandUtil { if (prob >= 1) { return true; } + if (prob === 0.5){ + return this.nextBit(); + } return this.nextFloat1() < prob; } diff --git a/src/sammo/RandUtil.php b/src/sammo/RandUtil.php index 403952f9..962fd5c4 100644 --- a/src/sammo/RandUtil.php +++ b/src/sammo/RandUtil.php @@ -42,6 +42,9 @@ class RandUtil if ($prob >= 1) { return true; } + if($prob === 0.5){ + return $this->nextBit(); + } return $this->nextFloat1() < $prob; }