#!/usr/bin/env python3
"""Generate a deterministic 5-column CSV of N rows for throughput benchmarks."""
import csv
import sys
from pathlib import Path

OUT = Path(__file__).parent / "sample.csv"
N = int(sys.argv[1]) if len(sys.argv) > 1 else 1_000_000


def main() -> None:
    with OUT.open("w", encoding="utf-8", newline="") as f:
        w = csv.writer(f)
        w.writerow(["id", "name", "email", "amount", "country"])
        for i in range(N):
            w.writerow([
                i,
                f"user_{i:08d}",
                f"user{i}@example.com",
                f"{(i % 100000) / 100:.2f}",
                ["JP", "US", "DE", "FR", "BR", "ES"][i % 6],
            ])
    print(f"Wrote {N:,} rows to {OUT} ({OUT.stat().st_size:,} bytes)")


if __name__ == "__main__":
    main()
