Skip to content

Instantly share code, notes, and snippets.

@Abacn
Created November 21, 2018 03:22
Show Gist options
  • Save Abacn/d0a5473c74c5df454e2d825acbcc6e51 to your computer and use it in GitHub Desktop.
Save Abacn/d0a5473c74c5df454e2d825acbcc6e51 to your computer and use it in GitHub Desktop.
Test C++11 Poisson distribution generator
// Test Poisson distribution generator
#include <stdio.h>
#include <time.h>
#include <random>
int main()
{
int ntest = 10;
double Nmin = 100000.;
std::default_random_engine generator;
generator.seed(time(0));
std::poisson_distribution<int> distribution(Nmin);
for(int i=0; i<ntest; ++i)
{
printf("%d\n", distribution(generator));
}
}
/* Outputs:
99966
100007
99690
99983
99605
100242
100016
100114
100239
99958
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment