public static function minDimensions(int $n, float $maxDistortion = 0.1) : int
    {
        return (int) round(4. * log($n)
            / ($maxDistortion ** 2 / 2. - $maxDistortion ** 3 / 3.));
    }
public static function minDimensions(int $n, float $maxDistortion = 0.1) : int
    {
        return (int) round(4. * log($n)
            / ($maxDistortion ** 2 / 2. - $maxDistortion ** 3 / 3.));
    }
public static function minDimensions ( int $ n , float $ maxDistortion = 0.1 ) : int { return ( int ) round ( 4. * log ( $ n ) / ( $ maxDistortion ** 2 / 2. - $ maxDistortion ** 3 / 3. ) ) ; }
Calculate the minimum number of dimensions for n total samples with a
given maximum distortion using the Johnson-Lindenstrauss lemma.

@param int $n
@param float $maxDistortion
@return int
Calculate the minimum number of dimensions for n total samples with a given maximum distortion using the Johnson - Lindenstrauss lemma .