@@ -25,6 +25,6 @@ |
||
| 25 | 25 | return $sample; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - abstract public function rangeRandom($min = 0, $max = PHP_INT_MAX, int $maxIterations = 20): ImmutableDecimal; |
|
| 28 | + abstract public function rangeRandom($min = 0, $max = PHP_INT_MAX, int $maxIterations = 20): ImmutableDecimal; |
|
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $cumulative = Numbers::makeZero(); |
| 80 | 80 | |
| 81 | - for ($i = 0;$x->isGreaterThanOrEqualTo($i);$i++) {
|
|
| 81 | + for ($i = 0; $x->isGreaterThanOrEqualTo($i); $i++) {
|
|
| 82 | 82 | $cumulative = $cumulative->add($this->pmf($i)); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $cumulative = Numbers::makeZero(); |
| 147 | 147 | |
| 148 | - for (;$larger->isGreaterThanOrEqualTo($smaller);$smaller->add(1)) {
|
|
| 148 | + for (;$larger->isGreaterThanOrEqualTo($smaller); $smaller->add(1)) {
|
|
| 149 | 149 | $cumulative = $cumulative->add($this->pmf($smaller)); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | while (true) {
|
| 227 | 227 | /** @var ImmutableDecimal $u */ |
| 228 | - $u = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX; |
|
| 228 | + $u = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX; |
|
| 229 | 229 | /** @var ImmutableDecimal $x */ |
| 230 | 230 | $x = $alpha->subtract($one->subtract($u)->divide($u)->ln(20)->divide($beta)); |
| 231 | 231 | /** @var ImmutableDecimal $n */ |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** @var ImmutableDecimal $v */ |
| 239 | - $v = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX; |
|
| 239 | + $v = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX; |
|
| 240 | 240 | /** @var ImmutableDecimal $y */ |
| 241 | 241 | $y = $alpha->subtract($beta->multiply($x)); |
| 242 | 242 | /** @var ImmutableDecimal $lhs */ |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | do {
|
| 278 | 278 | $k = $k->add(1); |
| 279 | 279 | /** @var ImmutableDecimal $u */ |
| 280 | - $u = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX; |
|
| 280 | + $u = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX; |
|
| 281 | 281 | $p = $p->multiply($u); |
| 282 | 282 | } while ($p->isGreaterThan($L)); |
| 283 | 283 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | $this->base = $base; |
| 38 | 38 | |
| 39 | - $value = (string)$value; |
|
| 39 | + $value = (string) $value; |
|
| 40 | 40 | $this->value = $this->translateValue($value); |
| 41 | 41 | |
| 42 | 42 | if (!is_null($precision)) { |
@@ -198,16 +198,16 @@ |
||
| 198 | 198 | * @var ImmutableDecimal $value1 |
| 199 | 199 | */ |
| 200 | 200 | foreach ($largerGroup as $key1 => $value1) { |
| 201 | - $largerKey = $largerExp - $key1; |
|
| 201 | + $largerKey = $largerExp-$key1; |
|
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * @var int $key2 |
| 205 | 205 | * @var ImmutableDecimal $value2 |
| 206 | 206 | */ |
| 207 | 207 | foreach ($smallerGroup as $key2 => $value2) { |
| 208 | - $smallerKey = $smallerExp - $key2; |
|
| 208 | + $smallerKey = $smallerExp-$key2; |
|
| 209 | 209 | $newVal = $value1->multiply($value2); |
| 210 | - $newExp = $largerKey + $smallerKey; |
|
| 210 | + $newExp = $largerKey+$smallerKey; |
|
| 211 | 211 | |
| 212 | 212 | if (isset($finalCoefs[$newExp])) { |
| 213 | 213 | $finalCoefs[$newExp] = $finalCoefs[$newExp]->add($newVal); |