1 from __future__ import absolute_import, division
6 def median(x, use_float=True):
7 # there exist better algorithms...
10 raise ValueError("empty sequence!")
11 left = (len(y) - 1)//2
13 sum = y[left] + y[right]
30 def clip(x, (low, high)):
46 raise ValueError("p must be in the interval (0.0, 1.0]")
49 return int(math.log1p(-random.random()) / math.log1p(-p)) + 1