123456789101112131415161718192021222324252627282930313233 |
- /*
- compile the example program with the following command line:
- g++ -O3 rngthreadexample.cpp rng_paraqueue_pool.cpp rng_queue_pool.cpp rngqueue.cpp -o rngthreadex -lgsl -lgslcblas -I/usr/include/qt4/QtCore -I/usr/include/qt4 -lQtCore -lpthread
- */
- #include <iostream>
- #include "rng_queue_pool.hpp"
- #include "rng_paraqueue_pool.hpp"
- using namespace std;
- int main()
- {
- const int NLoops=1000;
- const double PoissonLambda=0.3;
- int NRngVectors=6;
- int NRNumbersPerVector=500;
- IRngQueue* rnq = RngParaQueuePool::getRngQueuePool()
- ->getRngQueue(kRngPoisson, PoissonLambda, NRngVectors, NRNumbersPerVector);
- const int NumsPerLine=35;
- cout << "Random numbers:\n";
- for (int i=0; i<NLoops;++i)
- {
- if ((i%NumsPerLine) == 0) cout << "\n";
- double RandomNum = rnq->getRandomNumber();
- cout << RandomNum << " ";
- }
- cout << "\n";
- return 0;
- }
|