import random


def t06_ManyGetPuts(C, pks, crypto, server):
    """Many clients upload many files and their contents are checked."""
    clients = [C("c" + str(n)) for n in range(10)]

    kvs = [{} for _ in range(10)]

    for _ in range(200):
        i = random.randint(0, 9)

        uuid1 = "%08x" % random.randint(0, 100)
        uuid2 = "%08x" % random.randint(0, 100)
        clients[i].upload(str(uuid1), str(uuid2))
        kvs[i][str(uuid1)] = str(uuid2)

    good = total = 0
    # verify integrity
    for i, (c, kv) in enumerate(zip(clients, kvs)):
        for k, v in kv.items():
            vv = c.download(k)
            if vv == v:
                good += 1
            total += 1
    return float(good) / total