Get range around median containing specified percentage of values.
@param values Values.
@param percent Values percentage around median.
@return Returns the range which containes specifies percentage of values.
359051
public static IntRange GetRange( int[] values, double percent ){
        int total = 0, n = values.length;

        // for all values
        for ( int i = 0; i < n; i++ )
        {
            // accumalate total
            total += values[i];
        }

        int min, max, hits;
        int h = (int) ( total * ( percent + ( 1 - percent ) / 2 ) );

        // get range min value
        for ( min = 0, hits = total; min < n; min++ )
        {
            hits -= values[min];
            if ( hits < h )
                break;
        }
        // get range max value
        for ( max = n - 1, hits = total; max >= 0; max-- )
        {
            hits -= values[max];
            if ( hits < h )
                break;
        }
        return new IntRange( min, max );
    }
90568
private Map<String, Double> computeStatistics(List<Double> values) {
    Map<String, Double> results = new HashMap<>() ;

    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (Double value : values) {
      stats.addValue(value);
    }

    results.put("mean", stats.getMean()) ;
    results.put("median", stats.getPercentile(50.0)) ;
    results.put("stdDeviation", stats.getStandardDeviation());
    results.put("iqr", stats.getPercentile(75) - stats.getPercentile(25));
    results.put("max", stats.getMax());
    results.put("min", stats.getMean());
    results.put("numberOfElements", (double)values.size()) ;

    return results ;
  }
792945
public static BigRational min(BigRational... values) {
		if (values.length == 0) {
			return BigRational.ZERO;
		}
		BigRational result = values[0];
		for (int i = 1; i < values.length; i++) {
			result = result.min(values[i]);
		}
		return result;
	}
1364239
@Pure
	public static int min(int... values) {
		if (values == null || values.length == 0) {
			return 0;
		}
		int min = values[0];
		for (final int v : values) {
			if (v < min) {
				min = v;
			}
		}
		return min;
	}
1362236
public static double min(final double[] values) {
		double min = NaN;
		if (values.length > 0) {
			min = values[0];

			for (int i = 0; i < values.length; ++i) {
				if (values[i] < min) {
					min = values[i];
				}
			}
		}

		return min;
	}
586454
public static final Double parsePercent(String value)
   {
      return value == null ? null : Double.valueOf(Double.parseDouble(value) * 100.0);
   }
1025331
@Override
    public Double reduce(List<Double> values) {
        double min = Double.MAX_VALUE;
        double max = Double.MIN_VALUE;

        for (Double value : values) {
            if (value == null) {
                value = 0.0;
            }

            double candidate = (value);

            if (candidate < min) {
                min = candidate;
            }
            if (candidate > max) {
                max = candidate;
            }
        }
        return max - min;
    }
425156
public static double Kurtosis(int[] values){
        double mean = Mean(values);
        double std = StdDev(values, mean);
        return Kurtosis(values, mean, std);
    }
922249
protected function median($values) {
        $count = count($values);

        if ($count === 1) {
            return reset($values);
        }

        $middlevalue = (int)floor(($count - 1) / 2);

        if ($count % 2) {
            // Odd number, middle is the median.
            $median = $values[$middlevalue];
        } else {
            // Even number, calculate avg of 2 medians.
            $low = $values[$middlevalue];
            $high = $values[$middlevalue + 1];
            $median = (($low + $high) / 2);
        }
        return intval($median);
    }
718203
static public <C, T extends C> Value<C, T> percentHeight (Toolkit<C, T> toolkit, final float percent) {
		return new TableValue<C, T>(toolkit) {
                        @Override
			public float get (T table) {
				return toolkit.getHeight(table) * percent;
			}
		};
	}
1134496
public static function percentile(array $values, float $p) : float
    {
        if (empty($values)) {
            throw new InvalidArgumentException('Percentile is not defined for'
                . ' an empty set.');
        }

        if ($p < 0. or $p > 100.) {
            throw new InvalidArgumentException('P must be between 0 and 1,'
                . " $p given.");
        }

        $n = count($values);

        sort($values);

        $x = ($p / 100) * ($n - 1) + 1;

        $xHat = (int) $x;

        $remainder = $x - $xHat;

        $a = $values[$xHat - 1];
        $b = $values[$xHat];

        return $a + $remainder * ($b - $a);
    }
722565
def percentAt(self, value):
        
        min_val = self.minimum()
        max_val = self.maximum()
        
        if value < min_val:
            return 0.0
        elif max_val < value:
            return 1.0
        
        # round the max value to sync with the values in the grid
        max_val = self.rounded(max_val)
        
        try:
            perc = (value - min_val) / float(max_val - min_val)
        except (TypeError, ZeroDivisionError):
            return 0.0
        
        return max(min(perc, 1.0), 0.0)
952708
public static <T> T pickRandom (T[] values)
    {
        return (values == null || values.length == 0) ? null : values[getInt(values.length)];
    }
1071434
public static Collection<Integer> appendRange(int start, int stop, Collection<Integer> values) {
		return appendRange(start, stop, 1, values);
	}
207781
def median(values):
    
    values.sort()
    n = int(len(values) / 2)
    return values[n]
943423
def valueAt(self, percent):
        
        min_val = self.minimum()
        max_val = self.maximum()
        
        # round the max value to sync with the values in the grid
        max_val = self.rounded(max_val)
        range_val = max(min(percent, 1.0), 0.0) * (max_val - min_val)
        return round(range_val + min_val, 1)
405582
public double max(double... values) {
        double max = Double.MIN_VALUE;
        for (int i = 0; i < values.length; i++) {
            if (i == 0 || values[i] > max) {
                max = values[i];
            }
        }
        
        return max;
    }