Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "testlib.h"
- #include <iostream>
- using namespace std;
- int main(int argc, char *argv[])
- {
- if (argc < 4)
- {
- cout << "Command line arguments are: seed length prefix nwinners" << endl;
- return 1;
- }
- int seed = atoi(argv[1]);
- int len = atoi(argv[2]);
- int prefix = atoi(argv[3]);
- int nwinners = atoi(argv[4]);
- rnd.setSeed(seed);
- set<int> winners;
- while ((int)winners.size() < nwinners)
- winners.insert(rnd.next(prefix + 1, len));
- for (int i = 1; i <= prefix; ++i)
- winners.insert(i);
- for (auto winner: winners)
- cout << winner << " ";
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement