fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <time.h>
  4.  
  5. int main() {
  6. srand ( time(NULL) );
  7. int die[6] = {1, 2, 3, 4, 5, 6};
  8.  
  9. std::random_shuffle(die, die+6);
  10.  
  11. for(int i = 0; i< 6; i++) {
  12. std::cout << die[i] << std::endl;
  13. }
  14. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
2
4
6
1
3
5