用公平硬币模拟 1/3 与 2/3
simulate an event that has probability , and an event that has probability .
题目详情
You have a fair coin and you want to simulate an event that has probability , and an event that has probability . How do you do it?
解析
抛两次硬币:
- HH → 事件 A(概率 )
- HT 或 TH → 事件 B(概率 )
- TT → 丢弃重来
因为在去掉 TT 后,HH/HT/TH 三种结果等概率,因此得到 与 。