Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我的失败概率 p = 0.2。失败定义为 0,成功定义为 1。如何在 Excel 单元格上进行模拟(这样我可以将其向下拖动)?也就是说,一个公式以 20% 的概率生成 0,以 80% 的概率生成 1。
谢谢!
rand 函数返回一个介于 0 和 1 之间的小数。如果它小于 0.2,则可以认为它失败。
=IF(RAND()<0.2,0,1)
RAND() 将给出一个介于 0 和 1 之间的随机数,因此您可以直接在 IF 中使用它: