def choice_distribution(a, p):
    assert len(a) == len(p)

    cdf = list(cumsum(p))
    normal = cdf[-1]
    cdf2 = [float(normal) / float(i) for i in cdf]
    uniform_sample = random_sample()
    idx = bisect.bisect_right(cdf2, uniform_sample)

    return a[idx]
dataset/ETHPy150Open joke2k/faker/faker/utils/distribution.py/choice_distribution/swapped operands of `/`