def METHOD_NAME(name, Md, Hd, size, N):
    print("Generating file %s..." % name)
    with open(name, "w") as f:
        h = 0
        w = csv.DictWriter(
            f,
            fieldnames=[
                "geometry_id",
                "hit_id",
                "channel0",
                "channel1",
                "timestamp",
                "value",
            ],
            lineterminator="\n",
        )
        w.writeheader()
        for m in range(N):
            acts = 0
            hits = rand(Md)
            points = set()
            for q in range(hits):
                cells = rand(Hd)
                center = (random.randint(0, size - 1), random.randint(0, size - 1))
                cands = [center]
                seen = set()
                for c in range(cells):
                    if not cands:
                        break
                    p = random.choice(cands)
                    if p not in points:
                        w.writerow(
                            {
                                "geometry_id": m,
                                "hit_id": h,
                                "channel0": p[0],
                                "channel1": p[1],
                                "timestamp": 0,
                                "value": random.uniform(0.1, 1.0),
                            }
                        )
                    acts += 1
                    seen.add(p)
                    cands += neighbourhood(p, size)
                    cands = [x for x in cands if x not in seen and x not in points]
                h += 1
                points |= seen