Skip to content

Instantly share code, notes, and snippets.

@tenpn
Created September 14, 2011 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenpn/1216696 to your computer and use it in GitHub Desktop.
Save tenpn/1216696 to your computer and use it in GitHub Desktop.
shuffle
#include <algorithm>
#include <vector>
#include <stdio>
int main()
{
typedef std::pair<int,int> Pos;
typedef std::pair<Pos, unsigned char> PosChar;
typedef vector<PosChar> list;
list.push_back(PosChar(Pos(1,2),'a'));
list.push_back(PosChar(Pos(2,3),'b'));
list.push_back(PosChar(Pos(3,4),'c'));
std::random_shuffle(list.begin(), list.end());
std::out << list[0] << ", " << list[1] << ", " << list[2];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment