function entropy = entropy(distribution)
  sum = 0;
  length = size(distribution, 1);

  for i = 1 : length
    if(distribution(i) == 0)
      continue
    end

    sum = sum + distribution(i) * log2(distribution(i));
  end

  entropy = -1 * sum;
end
