I have a std::vector that I need to shuffle. It is only ~20 members in size. It also needs to produce a different shuffle every time the program is run.
Right now I am using random_shuffle
, however, it gives the same result every time the program is run. I tried that srand(unsigned(time(NULL)));
that was suggested in this thread, however, that didn't work on my platform.
If possible, I want to use only standard code.
Edit: Here is my implementation:
vector<Tile>gameTiles;
gameTiles.push_back(Tile(0,0));
gameTiles.push_back(Tile(0,1));
gameTiles.push_back(Tile(0,2));
gameTiles.push_back(Tile(0,3));
gameTiles.push_back(Tile(0,4));
//etc. ~20 member
random_shuffle(gameTiles.begin(), gameTiles.end());