Example #1
0
double Bippo::sample(RandomGen* rg) {
    // First sample from Poisson...
    double sample = poisson_sample(rg);
    // ...then from binomial (n tries)
    for (uint i=0; i<n; i++)
    {
        double r = rg->get_rand();

        if (r<theta) sample++;
    }

    return sample;
}
int main(int argc, char **argv) {
  double ht = atof(argv[1]);  // height
  double wd = atof(argv[2]);  // width
  int np = atoi(argv[3]);     // new points count

  double a = atof(argv[4]);   // octaves
  double b = atof(argv[5]);   // persistence
  double c = atof(argv[6]);   // scale
  double d = atof(argv[7]);   // min
  double e = atof(argv[8]);   // max
  double f = atof(argv[9]);   // seed

  std::vector<Point> pts = poisson_sample(ht, wd, np, a, b, c, d, e, f);
  for (int i = 0; i < pts.size(); ++i) {
    std::cout << pts[i].x << ", " << pts[i].y << std::endl;
  }
  return 0;
}