Created
November 21, 2018 03:22
-
-
Save Abacn/d0a5473c74c5df454e2d825acbcc6e51 to your computer and use it in GitHub Desktop.
Test C++11 Poisson distribution generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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