kripso / climathon-fiit-re

2 stars 0 forks source link

Implement first iteration with datasets (will be needeed for statistics and visualisations) #9

Open kripso opened 11 months ago

kripso commented 11 months ago
import random
from functools import reduce

def gen_avg(expected_avg=27, n=22, a=20, b=46):
    while True:
        l = [random.randint(a, b) for i in range(n)]
        avg = reduce(lambda x, y: x + y, l) / len(l)

        if avg == expected_avg:
            return l

print(gen_avg())