Пример #1
0
        public double ComputeAverage(double[] times, int count)
        {
            if (count == 0)
            {
                return(Double.NaN);
            }
            int    cap        = Math.Min(times.Length, count);
            double totalTimes = 0;

            for (int i = 0; i < cap; ++i)
            {
                totalTimes += times[i];
            }
            return(totalTimes / (double)cap);
        }
Пример #2
0
 public double ComputeAverage(double[] times, int count)
 {
     if (count == 0) return Double.NaN;
     int cap = Math.Min(times.Length, count);
     double totalTimes = 0;
     for (int i = 0; i < cap; ++i)
         totalTimes += times[i];
     return totalTimes / (double)cap;
 }