fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <numeric>
  5. int main()
  6. {
  7. std::vector<int> v(10);
  8. std::iota(v.begin(), v.end(), 1);
  9. std::random_shuffle(v.begin(), v.end());
  10.  
  11. for(std::size_t n=0; n<v.size(); ++n)
  12. std::cout << v[n] << ' ';
  13. }
  14.  
Success #stdin #stdout 0s 2960KB
stdin
Standard input is empty
stdout
5 4 8 9 1 6 3 2 7 10