Advertisement
mr1302

Untitled

Sep 14th, 2021
934
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <bitset>
  4. #include <random>
  5. #include <ctime>
  6. #include <vector>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.     vector<bitset<1000000>> a (10);
  12.     ofstream file("nums.txt");
  13.     srand(time(0));
  14.     for (int i = 0; i < 9000000; ++i) {
  15.         if (i % 1000 == 0) {
  16.             cout << "Still computing" << '\n';
  17.         }
  18.         while (true) {
  19.             int j = ((int)rand()) % 9000000 + 1000000;
  20.             if (!a[j / 1000000][j % 1000000]) {
  21.                 file << j << '\n';
  22.                 a[j / 1000000][j % 1000000] = 1;
  23.                 break;
  24.             }
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement