@@ -2,10 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace drupol\Yaroc\Plugin\RandomLib\Source; |
| 4 | 4 | |
| 5 | +use SecurityLib\Strength; |
|
| 5 | 6 | use drupol\Yaroc\Plugin\Method\GenerateIntegers; |
| 6 | 7 | use drupol\Yaroc\RandomOrgAPI; |
| 7 | 8 | use drupol\Yaroc\RandomOrgAPIInterface; |
| 8 | -use SecurityLib\Strength; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * The Random.Org Source. |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace drupol\Yaroc\Plugin\RychRandom\Generator; |
| 4 | 4 | |
| 5 | +use Rych\Random\Generator\GeneratorInterface; |
|
| 5 | 6 | use drupol\Yaroc\Plugin\Method\GenerateIntegers; |
| 6 | 7 | use drupol\Yaroc\RandomOrgAPI; |
| 7 | 8 | use drupol\Yaroc\RandomOrgAPIInterface; |
| 8 | -use Rych\Random\Generator\GeneratorInterface; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * The Random.Org Generator. |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace drupol\Yaroc; |
| 4 | 4 | |
| 5 | -use drupol\Yaroc\Plugin\ProviderInterface; |
|
| 6 | 5 | use Http\Client\HttpClient; |
| 7 | 6 | use Http\Discovery\HttpClientDiscovery; |
| 8 | 7 | use Psr\Http\Message\ResponseInterface; |
| 8 | +use drupol\Yaroc\Plugin\ProviderInterface; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Class RandomOrgAPI. |
@@ -24,21 +24,21 @@ |
||
| 24 | 24 | public function run($n = 1000) |
| 25 | 25 | { |
| 26 | 26 | $provider = Provider::withResource('generateDecimalFractions') |
| 27 | - ->withParameters(['n' => $n * 2, 'decimalPlaces' => 6]); |
|
| 27 | + ->withParameters(['n' => $n*2, 'decimalPlaces' => 6]); |
|
| 28 | 28 | |
| 29 | 29 | $numbers = $this->getRandomOrgAPI()->getData($provider); |
| 30 | 30 | |
| 31 | 31 | $inside = 0; |
| 32 | 32 | for ($i = 0; $i < $n; $i++) { |
| 33 | 33 | $x = $numbers[$i]; |
| 34 | - $y = $numbers[$i+1]; |
|
| 34 | + $y = $numbers[$i + 1]; |
|
| 35 | 35 | |
| 36 | 36 | if (sqrt($x*$x + $y*$y) <= 1) { |
| 37 | 37 | $inside++; |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $this->estimation = 4 * $inside/$n; |
|
| 41 | + $this->estimation = 4*$inside/$n; |
|
| 42 | 42 | |
| 43 | 43 | return $this; |
| 44 | 44 | } |
@@ -27,9 +27,9 @@ |
||
| 27 | 27 | $result = $this->getRandomOrgAPI()->getData($provider); |
| 28 | 28 | |
| 29 | 29 | $this->coordinates = [ |
| 30 | - 'x' => rad2deg($result[0] * 2 * pi() - pi()), |
|
| 31 | - 'y' => rad2deg(pi()/2 - acos($result[1] * 2 - 1)), |
|
| 32 | - 'z' => $result[2] * 1000, |
|
| 30 | + 'x' => rad2deg($result[0]*2*pi() - pi()), |
|
| 31 | + 'y' => rad2deg(pi()/2 - acos($result[1]*2 - 1)), |
|
| 32 | + 'z' => $result[2]*1000, |
|
| 33 | 33 | ]; |
| 34 | 34 | |
| 35 | 35 | return $this; |