from random import gammavariate

def dirichlet(n):
    samples = [gammavariate(1, 1) for _ in range(n)]
sum_samples = sum(samples)
return [(x / sum_samples) for x in samples]
non-uniform distributed random array