随机分组 使用教程
详细使用指南、最佳实践与常见问题解答
使用场景
随机分组工具适用于课堂小组活动、团队任务分配、活动抽奖、座位安排、值班排班、桌游分组等场景。无需安装 App,完全在浏览器中运行,名单不上传,隐私安全。
Use Cases
The Random Grouping tool is ideal for classroom group activities, team task allocation, raffles, seating arrangements, shift scheduling, board game grouping, etc. No install needed — runs in the browser; names never uploaded.
功能特点
- 两种模式:按组数分(指定分几组)/ 按每组人数(指定每组几人)
- 密码学安全:使用 Web Crypto API 的 getRandomValues,远比 Math.random 公平
- Fisher-Yates 洗牌算法:确保每个排列概率均等
- 余数智能分配:余下的人从前到后依次补到各组
- 彩色分组卡片:每组一种颜色,序号编号清晰
- 实时预览:输入名单时显示总人数与预估分组分布
- 一键复制:复制完整分组结果到剪贴板
- 本地处理:名单与结果完全在浏览器中,不联网
Features
- Two modes: By group count / By per-group size
- Cryptographically secure: uses Web Crypto API getRandomValues, far fairer than Math.random
- Fisher-Yates shuffle: ensures every permutation has equal probability
- Smart remainder: extra members are distributed front-to-back
- Color-coded cards: each group gets a distinct color with numbered members
- Live preview: shows total count and projected group sizes as you type
- One-click copy: full result copied to clipboard
- Local processing: names and results stay in the browser; no network calls
使用示例
示例 1:场景一:课堂分组 — 30 名学生分 6 组,选"按组数分"= 6,粘贴名单,一键生成 5 人 × 6 组。
示例 2:场景二:年会抽奖 — 100 人抽 3 组(一等奖/二等奖/三等奖),选"按组数分"= 3,自动按 34/33/33 分布。
示例 3:场景三:桌游分组 — 8 人玩狼人杀,选"按组数分"= 2,得到 4 vs 4 阵营。
示例 4:场景四:值班排班 — 12 人分 4 组轮班,选"按组数分"= 4,公平分配 3 人 × 4 组。
Examples
Example 1: Scenario 1: Classroom — 30 students into 6 groups; pick "By group count" = 6, paste names, get 5 × 6.
Example 2: Scenario 2: Year-end raffle — 100 people into 3 prize tiers; pick "By group count" = 3; auto-distributes 34/33/33.
Example 3: Scenario 3: Board game — 8 players for Werewolf; pick "By group count" = 2; get 4 vs 4 factions.
Example 4: Scenario 4: Shift scheduling — 12 staff into 4 shifts; pick "By group count" = 4; fair 3 × 4 distribution.
最佳实践
- 从 Excel/CSV 复制名单时,选"按列粘贴"或先用记事本清理为每行一项
- 同一人名多次出现不会被去重,如需去重请先在外部处理
- 需要可重现的结果时,记录分组后截图保存(每次分组都是新的随机)
- 名单超过 1000 项仍可处理,但建议拆分批次以保持响应速度
- Web Crypto API 在 HTTPS 与 localhost 下可用,部署到生产环境会自动启用
Best Practices
- When pasting from Excel/CSV, use "paste as column" or clean in Notepad first (one name per line)
- Duplicate names are not deduplicated; dedupe externally if needed
- For reproducible results, screenshot the result (each click is a new random)
- Lists over 1000 items still work but consider splitting for responsiveness
- Web Crypto API works on HTTPS and localhost; auto-enabled in production
常见问题
为什么比 Math.random 更公平?
Math.random 基于伪随机数生成器(PRNG),理论上有可预测性。Web Crypto API 的 getRandomValues 使用操作系统熵池(硬件噪声),密码学安全,无法预测,分组结果更公平。
余数怎么处理?例如 30 人分 4 组。
30 ÷ 4 = 7 余 2,系统会生成 8+8+7+7 的分布(余数从前到后分配),确保人数差不超过 1。
名单会被上传到服务器吗?
不会。所有处理在浏览器本地完成,断网也能用。F12 打开开发者工具的 Network 面板可以验证没有任何网络请求。
可以保存分组结果吗?
可点"复制结果"按钮复制到剪贴板,然后粘贴到 Excel/Notion 等。本工具不持久化结果,刷新页面会清空。
FAQ
Why is it fairer than Math.random?
Math.random is a pseudo-random number generator (PRNG) with theoretical predictability. Web Crypto API's getRandomValues uses the OS entropy pool (hardware noise), cryptographically secure and unpredictable — fairer grouping.
How are remainders handled? E.g. 30 people into 4 groups.
30 ÷ 4 = 7 remainder 2; the tool produces 8+8+7+7 (remainder distributed front-to-back), keeping group sizes within 1 of each other.
Are names uploaded to a server?
No. All processing is local in the browser; works offline. Open DevTools → Network to verify zero network requests.
Can I save the result?
Click "Copy Result" to copy to clipboard, then paste into Excel/Notion. The tool does not persist results; refresh clears them.