You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: probability.rb
    path of file: ./repos/facets/lib/core/facets/array
    
    the code of the file until where you have to start completion: class Array

  # Generates a hash mapping each unique element in the array to the
  # relative frequency, i.e. the 
    
  def probability
    probs = Hash.new(0.0)
    size = 0.0
    each do |e|
      probs[e] += 1.0
      size += 1.0
    end
    probs.keys.each{ |e| probs[e] /= size }
    probs
  end