兄弟们啊,帮我看看我的泊松分布生成随机数
#include <stdio.h>#include <stdlib.h>
#include <string.h>
int main(void)
{
long cls_random::random Possion(double lambda)
{
double x = -1, u;
double log1, log2;
log1 = 0;
log2 = -lambda;
do
{
u = cls_random::randomUniform();
log1 += log(u);
x++;
}while(log1 >= log2);
return x;
}
}