zenefits oa - random to generate a random
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zenefits oa - random to generate a random相关的知识,希望对你有一定的参考价值。
If given a function that generates a random number from 1 to 5, how do you use this function to generate a random number from 1 to 7 with the same probability? (ie. function a has probability 1/5 per number, function b would have probability 1/7).
int sum = 0;
int times = 5;
while(times>0){
times--;
sum += rand(5);
}
// 5 ~ 25 = 3 *7
return (sum - 2) / 3;
以上是关于zenefits oa - random to generate a random的主要内容,如果未能解决你的问题,请参考以下文章
如何在 Mac 上将 #include <random> 与 g++ 一起使用?
条件随机场介绍—— An Introduction to Conditional Random Fields
安装OA办公平台对公司网络及电脑有啥要求?网络需要用宽带的吗?电脑需要啥配置的?