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; }