Sha256: eebc89d81cb448b33c11628b779025e4c035ca84e4e24c17cf5f07622e1cb4a3

Contents?: true

Size: 266 Bytes

Versions: 3

Compression:

Stored size: 266 Bytes

Contents

# frozen_string_literal: true

module Helpers
  def percentile(p, arr, len)
    return arr[len - 1] if p == 100
    rank = p / 100.0 * (len - 1)
    lower = arr[rank.floor]
    upper = arr[rank.floor + 1]
    lower + (upper - lower) * (rank - rank.floor)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fast_statistics-0.2.1 benchmark/helpers.rb
fast_statistics-0.2.0 benchmark/helpers.rb
fast_statistics-0.1.1 benchmark/helpers.rb