Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "stdc++.h"
- using namespace std;
- void lcg(vector<unsigned int>& r, int seed, int size, unsigned long a, unsigned long c, unsigned long m){
- if (size == 1){
- r.push_back((a*seed+c)%m);
- return;
- }
- for(int i = 0; i < size; ++i){
- r.push_back(0);
- }
- r[0] = seed;
- for(int i = 1; i < size; ++i){
- r[i] = uint32_t((a*r[i-1]+c)%m);
- }
- r.erase(r.begin());
- }
- void generate_v3_0(int seed, long sizeA, long sizeB, long sizeInter, vector<unsigned int> & a, vector<unsigned int>& b) {
- lcg(a, seed, sizeA+1, 50001, 49999, 2500000000);
- (sizeA!=sizeInter)?lcg(b, a[sizeA-sizeInter-1], sizeB+1, 50001, 49999, 2500000000):lcg(b, seed, sizeB+1, 50001, 49999, 2500000000);
- std::shuffle(a.begin(), a.end(), std::default_random_engine(seed+1));
- std::shuffle(b.begin(), b.end(), std::default_random_engine(seed+2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement