fork download
  1. #include <random>
  2. #include <algorithm>
  3. #include <iostream>
  4. #include<ctime>
  5.  
  6. int main()
  7. {
  8. int arr[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
  9.  
  10.  
  11. srand(time(NULL));
  12. std::random_shuffle(&arr[0][0], &arr[0][0] + sizeof(arr)/sizeof(arr[0][0]));
  13.  
  14. for(std::size_t i = 0; i < 4; ++i)
  15. {
  16. for(std::size_t j = 0; j < 2; ++j)
  17. std::cout << arr[i][j] << " ";
  18. std::cout << std::endl;
  19. }
  20.  
  21.  
  22. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
0 0 
-1 0 
1 -1 
0 1