LoginSignup
6
4

More than 3 years have passed since last update.

ポワソン分布発生 

Last updated at Posted at 2013-01-09
int poisson(double lambda)  {
    double xp;
    int k = 0;
    xp = Math.random();
    while (xp >= Math.exp(-lambda)) {
        xp = xp * Math.random();
        k = k + 1;
    }
    return (k);
}
6
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4