Skip to content

Instantly share code, notes, and snippets.

@Xevion
Created September 27, 2023 21:36
Show Gist options
  • Save Xevion/1b5c971e88ac51521c133cc7e04ecdff to your computer and use it in GitHub Desktop.
Save Xevion/1b5c971e88ac51521c133cc7e04ecdff to your computer and use it in GitHub Desktop.
def score(distribution):
count = len(distribution)
deviation = [abs(1 / count - d) for d in distribution]
avg_deviation = sum(deviation) / count
return 1 - sum(deviation) / count
print(score([1 / 5 for _ in range(5)]))
print(score([0.12, 0.33, 0.55]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment