mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 10:12:28 +01:00 
			
		
		
		
	Minor performance boost
This commit is contained in:
		
							
								
								
									
										70
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										70
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							@@ -822,21 +822,21 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "nikic/php-parser",
 | 
					            "name": "nikic/php-parser",
 | 
				
			||||||
            "version": "v4.18.0",
 | 
					            "version": "v4.19.1",
 | 
				
			||||||
            "source": {
 | 
					            "source": {
 | 
				
			||||||
                "type": "git",
 | 
					                "type": "git",
 | 
				
			||||||
                "url": "https://github.com/nikic/PHP-Parser.git",
 | 
					                "url": "https://github.com/nikic/PHP-Parser.git",
 | 
				
			||||||
                "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999"
 | 
					                "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "dist": {
 | 
					            "dist": {
 | 
				
			||||||
                "type": "zip",
 | 
					                "type": "zip",
 | 
				
			||||||
                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999",
 | 
					                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b",
 | 
				
			||||||
                "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999",
 | 
					                "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b",
 | 
				
			||||||
                "shasum": ""
 | 
					                "shasum": ""
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "require": {
 | 
					            "require": {
 | 
				
			||||||
                "ext-tokenizer": "*",
 | 
					                "ext-tokenizer": "*",
 | 
				
			||||||
                "php": ">=7.0"
 | 
					                "php": ">=7.1"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "require-dev": {
 | 
					            "require-dev": {
 | 
				
			||||||
                "ircmaxell/php-yacc": "^0.0.7",
 | 
					                "ircmaxell/php-yacc": "^0.0.7",
 | 
				
			||||||
@@ -872,9 +872,9 @@
 | 
				
			|||||||
            ],
 | 
					            ],
 | 
				
			||||||
            "support": {
 | 
					            "support": {
 | 
				
			||||||
                "issues": "https://github.com/nikic/PHP-Parser/issues",
 | 
					                "issues": "https://github.com/nikic/PHP-Parser/issues",
 | 
				
			||||||
                "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0"
 | 
					                "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "time": "2023-12-10T21:03:43+00:00"
 | 
					            "time": "2024-03-17T08:10:35+00:00"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "phar-io/manifest",
 | 
					            "name": "phar-io/manifest",
 | 
				
			||||||
@@ -1287,16 +1287,16 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "phpstan/phpstan",
 | 
					            "name": "phpstan/phpstan",
 | 
				
			||||||
            "version": "1.10.60",
 | 
					            "version": "1.10.63",
 | 
				
			||||||
            "source": {
 | 
					            "source": {
 | 
				
			||||||
                "type": "git",
 | 
					                "type": "git",
 | 
				
			||||||
                "url": "https://github.com/phpstan/phpstan.git",
 | 
					                "url": "https://github.com/phpstan/phpstan.git",
 | 
				
			||||||
                "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe"
 | 
					                "reference": "ad12836d9ca227301f5fb9960979574ed8628339"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "dist": {
 | 
					            "dist": {
 | 
				
			||||||
                "type": "zip",
 | 
					                "type": "zip",
 | 
				
			||||||
                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/95dcea7d6c628a3f2f56d091d8a0219485a86bbe",
 | 
					                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ad12836d9ca227301f5fb9960979574ed8628339",
 | 
				
			||||||
                "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe",
 | 
					                "reference": "ad12836d9ca227301f5fb9960979574ed8628339",
 | 
				
			||||||
                "shasum": ""
 | 
					                "shasum": ""
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "require": {
 | 
					            "require": {
 | 
				
			||||||
@@ -1345,20 +1345,20 @@
 | 
				
			|||||||
                    "type": "tidelift"
 | 
					                    "type": "tidelift"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            "time": "2024-03-07T13:30:19+00:00"
 | 
					            "time": "2024-03-18T16:53:53+00:00"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "phpunit/php-code-coverage",
 | 
					            "name": "phpunit/php-code-coverage",
 | 
				
			||||||
            "version": "10.1.13",
 | 
					            "version": "10.1.14",
 | 
				
			||||||
            "source": {
 | 
					            "source": {
 | 
				
			||||||
                "type": "git",
 | 
					                "type": "git",
 | 
				
			||||||
                "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
 | 
					                "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
 | 
				
			||||||
                "reference": "d51c3aec14896d5e80b354fad58e998d1980f8f8"
 | 
					                "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "dist": {
 | 
					            "dist": {
 | 
				
			||||||
                "type": "zip",
 | 
					                "type": "zip",
 | 
				
			||||||
                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d51c3aec14896d5e80b354fad58e998d1980f8f8",
 | 
					                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b",
 | 
				
			||||||
                "reference": "d51c3aec14896d5e80b354fad58e998d1980f8f8",
 | 
					                "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b",
 | 
				
			||||||
                "shasum": ""
 | 
					                "shasum": ""
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "require": {
 | 
					            "require": {
 | 
				
			||||||
@@ -1415,7 +1415,7 @@
 | 
				
			|||||||
            "support": {
 | 
					            "support": {
 | 
				
			||||||
                "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
 | 
					                "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
 | 
				
			||||||
                "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
 | 
					                "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
 | 
				
			||||||
                "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.13"
 | 
					                "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "funding": [
 | 
					            "funding": [
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@@ -1423,7 +1423,7 @@
 | 
				
			|||||||
                    "type": "github"
 | 
					                    "type": "github"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            "time": "2024-03-09T16:54:15+00:00"
 | 
					            "time": "2024-03-12T15:33:41+00:00"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "phpunit/php-file-iterator",
 | 
					            "name": "phpunit/php-file-iterator",
 | 
				
			||||||
@@ -1670,16 +1670,16 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "phpunit/phpunit",
 | 
					            "name": "phpunit/phpunit",
 | 
				
			||||||
            "version": "10.5.12",
 | 
					            "version": "10.5.13",
 | 
				
			||||||
            "source": {
 | 
					            "source": {
 | 
				
			||||||
                "type": "git",
 | 
					                "type": "git",
 | 
				
			||||||
                "url": "https://github.com/sebastianbergmann/phpunit.git",
 | 
					                "url": "https://github.com/sebastianbergmann/phpunit.git",
 | 
				
			||||||
                "reference": "41a9886b85ac7bf3929853baf96b95361cd69d2b"
 | 
					                "reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "dist": {
 | 
					            "dist": {
 | 
				
			||||||
                "type": "zip",
 | 
					                "type": "zip",
 | 
				
			||||||
                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/41a9886b85ac7bf3929853baf96b95361cd69d2b",
 | 
					                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/20a63fc1c6db29b15da3bd02d4b6cf59900088a7",
 | 
				
			||||||
                "reference": "41a9886b85ac7bf3929853baf96b95361cd69d2b",
 | 
					                "reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7",
 | 
				
			||||||
                "shasum": ""
 | 
					                "shasum": ""
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "require": {
 | 
					            "require": {
 | 
				
			||||||
@@ -1751,7 +1751,7 @@
 | 
				
			|||||||
            "support": {
 | 
					            "support": {
 | 
				
			||||||
                "issues": "https://github.com/sebastianbergmann/phpunit/issues",
 | 
					                "issues": "https://github.com/sebastianbergmann/phpunit/issues",
 | 
				
			||||||
                "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
 | 
					                "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
 | 
				
			||||||
                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.12"
 | 
					                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.13"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "funding": [
 | 
					            "funding": [
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@@ -1767,7 +1767,7 @@
 | 
				
			|||||||
                    "type": "tidelift"
 | 
					                    "type": "tidelift"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            "time": "2024-03-09T12:04:07+00:00"
 | 
					            "time": "2024-03-12T15:37:41+00:00"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "psalm/plugin-phpunit",
 | 
					            "name": "psalm/plugin-phpunit",
 | 
				
			||||||
@@ -1934,16 +1934,16 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "rector/rector",
 | 
					            "name": "rector/rector",
 | 
				
			||||||
            "version": "1.0.2",
 | 
					            "version": "1.0.3",
 | 
				
			||||||
            "source": {
 | 
					            "source": {
 | 
				
			||||||
                "type": "git",
 | 
					                "type": "git",
 | 
				
			||||||
                "url": "https://github.com/rectorphp/rector.git",
 | 
					                "url": "https://github.com/rectorphp/rector.git",
 | 
				
			||||||
                "reference": "7596fa6da06c6a20c012efe6bb3d9188a9113b11"
 | 
					                "reference": "c59507a9090b465d65e1aceed91e5b81986e375b"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "dist": {
 | 
					            "dist": {
 | 
				
			||||||
                "type": "zip",
 | 
					                "type": "zip",
 | 
				
			||||||
                "url": "https://api.github.com/repos/rectorphp/rector/zipball/7596fa6da06c6a20c012efe6bb3d9188a9113b11",
 | 
					                "url": "https://api.github.com/repos/rectorphp/rector/zipball/c59507a9090b465d65e1aceed91e5b81986e375b",
 | 
				
			||||||
                "reference": "7596fa6da06c6a20c012efe6bb3d9188a9113b11",
 | 
					                "reference": "c59507a9090b465d65e1aceed91e5b81986e375b",
 | 
				
			||||||
                "shasum": ""
 | 
					                "shasum": ""
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "require": {
 | 
					            "require": {
 | 
				
			||||||
@@ -1978,7 +1978,7 @@
 | 
				
			|||||||
            ],
 | 
					            ],
 | 
				
			||||||
            "support": {
 | 
					            "support": {
 | 
				
			||||||
                "issues": "https://github.com/rectorphp/rector/issues",
 | 
					                "issues": "https://github.com/rectorphp/rector/issues",
 | 
				
			||||||
                "source": "https://github.com/rectorphp/rector/tree/1.0.2"
 | 
					                "source": "https://github.com/rectorphp/rector/tree/1.0.3"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "funding": [
 | 
					            "funding": [
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@@ -1986,7 +1986,7 @@
 | 
				
			|||||||
                    "type": "github"
 | 
					                    "type": "github"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            "time": "2024-03-03T12:32:31+00:00"
 | 
					            "time": "2024-03-14T15:04:18+00:00"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "sebastian/cli-parser",
 | 
					            "name": "sebastian/cli-parser",
 | 
				
			||||||
@@ -3661,16 +3661,16 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "vimeo/psalm",
 | 
					            "name": "vimeo/psalm",
 | 
				
			||||||
            "version": "5.23.0",
 | 
					            "version": "5.23.1",
 | 
				
			||||||
            "source": {
 | 
					            "source": {
 | 
				
			||||||
                "type": "git",
 | 
					                "type": "git",
 | 
				
			||||||
                "url": "https://github.com/vimeo/psalm.git",
 | 
					                "url": "https://github.com/vimeo/psalm.git",
 | 
				
			||||||
                "reference": "005e3184fb6de4350a873b9b8c4dc3cede9db762"
 | 
					                "reference": "8471a896ccea3526b26d082f4461eeea467f10a4"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "dist": {
 | 
					            "dist": {
 | 
				
			||||||
                "type": "zip",
 | 
					                "type": "zip",
 | 
				
			||||||
                "url": "https://api.github.com/repos/vimeo/psalm/zipball/005e3184fb6de4350a873b9b8c4dc3cede9db762",
 | 
					                "url": "https://api.github.com/repos/vimeo/psalm/zipball/8471a896ccea3526b26d082f4461eeea467f10a4",
 | 
				
			||||||
                "reference": "005e3184fb6de4350a873b9b8c4dc3cede9db762",
 | 
					                "reference": "8471a896ccea3526b26d082f4461eeea467f10a4",
 | 
				
			||||||
                "shasum": ""
 | 
					                "shasum": ""
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "require": {
 | 
					            "require": {
 | 
				
			||||||
@@ -3767,7 +3767,7 @@
 | 
				
			|||||||
                "issues": "https://github.com/vimeo/psalm/issues",
 | 
					                "issues": "https://github.com/vimeo/psalm/issues",
 | 
				
			||||||
                "source": "https://github.com/vimeo/psalm"
 | 
					                "source": "https://github.com/vimeo/psalm"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "time": "2024-03-09T19:39:11+00:00"
 | 
					            "time": "2024-03-11T20:33:46+00:00"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "name": "webmozart/assert",
 | 
					            "name": "webmozart/assert",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,6 +12,8 @@ namespace DNW\Skills\Numerics;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
class GaussianDistribution implements \Stringable
 | 
					class GaussianDistribution implements \Stringable
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    private const DEFAULT_STANDARD_DEVIATION = 1.0;
 | 
				
			||||||
 | 
					    private const DEFAULT_MEAN = 0.0;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Square Root 2π.
 | 
					     * Square Root 2π.
 | 
				
			||||||
     * Precalculated constant for performance reasons
 | 
					     * Precalculated constant for performance reasons
 | 
				
			||||||
@@ -32,16 +34,21 @@ class GaussianDistribution implements \Stringable
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // precision and precisionMean are used because they make multiplying and dividing simpler
 | 
					    // precision and precisionMean are used because they make multiplying and dividing simpler
 | 
				
			||||||
    // (the the accompanying math paper for more details)
 | 
					    // (the the accompanying math paper for more details)
 | 
				
			||||||
    private float $precision;
 | 
					    private float $precision = 1.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private float $precisionMean;
 | 
					    private float $precisionMean = 0.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private float $variance;
 | 
					    private float $variance = 1.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function __construct(private float $mean = 0.0, private float $standardDeviation = 1.0)
 | 
					    public function __construct(private float $mean = self::DEFAULT_MEAN, private float $standardDeviation = self::DEFAULT_STANDARD_DEVIATION)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->variance = BasicMath::square($standardDeviation);
 | 
					        if($mean == self::DEFAULT_MEAN && $standardDeviation == self::DEFAULT_STANDARD_DEVIATION)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //Use all the defaults
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->variance = BasicMath::square($standardDeviation);
 | 
				
			||||||
        if ($this->variance != 0) {
 | 
					        if ($this->variance != 0) {
 | 
				
			||||||
            $this->precision = 1.0 / $this->variance;
 | 
					            $this->precision = 1.0 / $this->variance;
 | 
				
			||||||
            $this->precisionMean = $this->precision * $this->mean;
 | 
					            $this->precisionMean = $this->precision * $this->mean;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user