Hey all,

Just for fun, I've decided to try to design a card game. However, as I'm pretty new at this, I'm taking baby steps. Anyways, the problem I have right now is how to generate 5 unique, random numbers from a predefined array.

Someone suggested that I check out the vector class and it seems to do what I want rather nicely. Right now, I am using random_shuffle() to randomly sort the elements of a predefined array. Here's my code:

#include <iostream>
#include <vector>

using namespace std;

int main()


vector <int> cards(5);

random_shuffle (cards.begin(), cards.end());

int na_playerhand[5];

for (int i=0; i<5, i++)
cout << playerhand[i]'

return 0;

While this code works great the first time around (i.e. it outputs the numbers 1-5 in random order, for example "35421"), for each subsequent time I run the program, I get the same sequence of numbers (i.e. the output is always "35421")---what gives?

As for the second question, my initialization of the array seems rather cumbersome, is there some kind of shortcut to initializing a vector array?