Advertisement
HellFinger

Untitled

May 12th, 2022
634
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include "stdc++.h"
  3. using namespace std;
  4.  
  5. void lcg(vector<unsigned int>& r, int seed, int size, unsigned long a, unsigned long c, unsigned long m){
  6.   if (size == 1){
  7.     r.push_back((a*seed+c)%m);
  8.     return;
  9.   }
  10.   for(int i = 0; i < size; ++i){
  11.     r.push_back(0);
  12.   }
  13.   r[0] = seed;
  14.   for(int i = 1; i < size; ++i){
  15.     r[i] = uint32_t((a*r[i-1]+c)%m);
  16.   }
  17.   r.erase(r.begin());
  18. }
  19.  
  20.  
  21.  
  22. void generate_v3_0(int seed, long sizeA, long sizeB, long sizeInter, vector<unsigned int> & a, vector<unsigned int>& b) {
  23.     lcg(a, seed, sizeA+1, 50001, 49999, 2500000000);
  24.     (sizeA!=sizeInter)?lcg(b, a[sizeA-sizeInter-1], sizeB+1, 50001, 49999, 2500000000):lcg(b, seed, sizeB+1, 50001, 49999, 2500000000);
  25.  
  26.     std::shuffle(a.begin(), a.end(), std::default_random_engine(seed+1));
  27.     std::shuffle(b.begin(), b.end(), std::default_random_engine(seed+2));
  28. }
Advertisement
RAW Paste Data Copied
Advertisement