Advertisement
mr1302

Untitled

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