Split non-empty name rows into balanced teams by team count or into fixed-capacity chunks.
Names are first permuted with Fisher–Yates and rejection-sampled indexes. Team-count mode deals the shuffled rows cyclically so sizes differ by no more than one; team-size mode slices consecutive chunks and permits a smaller final team.
Names: ["Ana","Ben","Cleo","Dan","Eve","Finn"] Team count: 2 Seed: gym-class
Team 1: Ben, Eve, Finn Team 2: Dan, Cleo, Ana
Physical-education classes form scrimmage teams, laboratory lessons fill benches to capacity, and workshops divide registrations among breakout groups.