fork download
  1. #include<vector>
  2. #include<iostream>
  3. #include<algorithm>
  4. #include<cstdio>
  5. #include<ctime>
  6.  
  7. int main ()
  8. {
  9. std::srand(std::time(NULL));
  10.  
  11. std::vector<int> initial = {
  12. 71,127,428,475,164,253,229,395,92,189,
  13. 41,110,443,490,278,305,28,58,371,560
  14. };
  15.  
  16. std::vector<std::vector<int>> allparents(10, std::vector<int>(20));
  17.  
  18. for(int r=0; r<10; ++r)
  19. {
  20. for(int c=0; c<20; ++c)
  21. {
  22. int i = rand() % (20 - c) + c;
  23. std::swap(initial[c], initial[i]);
  24. allparents[r][c] = initial[c];
  25. std::cout << ' ' << allparents[r][c];
  26. }
  27. std::cout << '\n';
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 4416KB
stdin
Standard input is empty
stdout
 371 490 560 305 92 253 229 110 395 443 164 127 278 475 189 28 71 58 41 428
 490 443 189 428 253 71 127 58 229 278 560 41 475 164 110 371 395 305 92 28
 41 229 475 28 443 560 127 371 490 71 110 305 164 428 189 92 278 253 58 395
 475 253 305 41 278 92 28 490 71 395 164 58 127 189 443 110 560 229 428 371
 428 278 71 490 395 92 127 110 58 371 443 253 560 475 164 189 28 41 305 229
 371 229 443 41 428 475 305 28 253 164 71 92 278 110 189 395 58 560 127 490
 41 110 371 253 395 278 475 58 428 305 560 490 443 164 71 127 28 92 189 229
 428 41 443 92 127 164 229 189 28 278 490 110 253 560 371 395 305 71 58 475
 395 164 189 305 41 560 490 92 28 71 229 475 443 371 278 110 58 253 428 127
 164 71 229 189 490 278 443 428 371 560 110 58 253 28 305 127 395 41 92 475