본문 바로가기
프로그래밍 기록/stl

shuffle

by hominic 2023. 12. 9.
728x90
반응형
반응형
#include <iostream>
#include <vector>
#include <algorithm>
#include <time.h>
using namespace std;


void main()
{
int i;
vector<int> vi(20);
vector<int>::iterator it;

for (i=0;i<20;i++) vi[i]=i;
srand(time(NULL));
random_shuffle(vi.begin(),vi.end());
for (it=vi.begin();it!=vi.end();it++) {
cout << *it << ' ';
}
cout << endl;
}
728x90
반응형

'프로그래밍 기록 > stl' 카테고리의 다른 글

search  (0) 2023.12.09
adjacent_find  (0) 2023.12.09
reverse  (0) 2023.12.09
sort  (0) 2023.12.09
find  (0) 2023.12.09

댓글