Skip to content

Instantly share code, notes, and snippets.

@peanutbother
peanutbother / sorts.py
Created May 30, 2016 14:00 — forked from amix/sorts.py
The confidence sort in pure Python (from Reddit's codebase)
# Rewritten code from /r2/r2/lib/db/_sorts.pyx
from math import sqrt
def confidence(ups, downs):
n = ups + downs
if n == 0:
return 0
z = 1.281551565545