非常详尽的数据结构中描述的算法 Introduction Structure of the chapters Naming of variables Probabilities Asymptotic notation About the programming languages On the code for the algorithms Complexity measures and real timings Basic Concepts (Expand) Data structure d
突发奇想给校友微信*了红包,我设定红包总额为10元,支持28个人随机领取。
于是一个有趣的结果出现了:
A 领取了 0.26元
B 领取了 0.29元
C 领取了 0.02元
D 领取了 0.56元
E 领取了 0.64元
……
微信是采用什么样的算法做到的?简单百度了下,目前尚未有官方的说明,仅仅在知乎里有一个较为热门的讨论,链接戳这里,不过他们讨论的太过于深入,有掉坑之嫌。
我按照自己的逻辑尝试了下,这个算法需要满足以下几点要求:
1、每个人都要能够领取到红包;
2、每个人领取到的红包金额