@@ -18,20 +18,20 @@ |
||
| 18 | 18 | * @return self |
| 19 | 19 | */ |
| 20 | 20 | public function run($n = 1000) { |
| 21 | - $numbers = $this->randomOrgAPI->call('generateDecimalFractions', ['n' => $n * 2, 'decimalPlaces' => 6]) |
|
| 21 | + $numbers = $this->randomOrgAPI->call('generateDecimalFractions', ['n' => $n*2, 'decimalPlaces' => 6]) |
|
| 22 | 22 | ->getData(); |
| 23 | 23 | |
| 24 | 24 | $inside = 0; |
| 25 | 25 | for ($i = 0; $i < $n; $i++) { |
| 26 | 26 | $x = $numbers[$i]; |
| 27 | - $y = $numbers[$i+1]; |
|
| 27 | + $y = $numbers[$i + 1]; |
|
| 28 | 28 | |
| 29 | 29 | if (sqrt($x*$x + $y*$y) <= 1) { |
| 30 | 30 | $inside++; |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - $this->estimation = 4 * $inside/$n; |
|
| 34 | + $this->estimation = 4*$inside/$n; |
|
| 35 | 35 | |
| 36 | 36 | return $this; |
| 37 | 37 | } |